<html>
<head><meta charset="utf-8"><title>windows-rs perf · t-compiler/performance · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/index.html">t-compiler/performance</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html">windows-rs perf</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223620445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223620445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223620445">(Jan 22 2021 at 09:48)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I've already done some perf work based on windows-rs, and I'd like to help you figure out what's going on. I believe the <code>finalize_macro_resolutions</code> will be the cause of the majority of the performance hit. Let me see if I can dig up my previous analysis.</p>



<a name="223622288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223622288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223622288">(Jan 22 2021 at 10:07)</a>:</h4>
<p>Hmmm I can't see to find it, but I have a Windows machine which I can run profiling on.</p>



<a name="223646033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646033">(Jan 22 2021 at 14:14)</a>:</h4>
<p>that would be awesome!</p>



<a name="223646081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646081">(Jan 22 2021 at 14:15)</a>:</h4>
<p>FWIW I believe you that <code>fnialize_macro_resolutions</code> is the main hit when <em>compiling</em>, but <code>resolve_crate</code> is only a third of the time when running <em>rustdoc</em></p>



<a name="223646208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646208">(Jan 22 2021 at 14:16)</a>:</h4>
<p><a href="https://github.com/microsoft/windows-rs/issues/420#issuecomment-764991646">https://github.com/microsoft/windows-rs/issues/420#issuecomment-764991646</a></p>



<a name="223646259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646259">(Jan 22 2021 at 14:16)</a>:</h4>
<p>need to add timing to <code>render_html</code>, I'm not sure if that time is spent on actual IO or just lots of memory allocations</p>



<a name="223646757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646757">(Jan 22 2021 at 14:20)</a>:</h4>
<p>and <a href="https://github.com/rust-lang/rust/issues/81251">https://github.com/rust-lang/rust/issues/81251</a> is just a bug, but I expect it's actually <code>get_blanket_impls</code> taking all the time</p>



<a name="223646767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223646767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223646767">(Jan 22 2021 at 14:21)</a>:</h4>
<p>which ... unfortunate, because I have no idea how to fix it</p>



<a name="223648234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223648234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223648234">(Jan 22 2021 at 14:33)</a>:</h4>
<p>(this would be so much easier with <a href="https://github.com/rust-lang/rust/pull/79540">https://github.com/rust-lang/rust/pull/79540</a>)</p>



<a name="223649462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223649462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223649462">(Jan 22 2021 at 14:43)</a>:</h4>
<p>Is it counter productive to also look into why building the crate itself takes so long? I'm interested in also improving compiling times</p>



<a name="223649739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223649739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223649739">(Jan 22 2021 at 14:45)</a>:</h4>
<p>I think so, yes - this is specifically about the time to build <code>windows-docs-rs</code></p>



<a name="223649764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223649764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223649764">(Jan 22 2021 at 14:45)</a>:</h4>
<p>which no one will ever build as a library, just for the docs</p>



<a name="223649797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223649797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223649797">(Jan 22 2021 at 14:46)</a>:</h4>
<p>(if you want to look into <code>windows-rs</code> be my guest, but that's not what I've been measuring so far)</p>



<a name="223649915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223649915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223649915">(Jan 22 2021 at 14:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223649764">said</a>:</p>
<blockquote>
<p>which no one will ever build as a library, just for the docs</p>
</blockquote>
<p>never be sure of that <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="223650001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223650001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223650001">(Jan 22 2021 at 14:47)</a>:</h4>
<p>I'm happy to help you. I will continue also looking into perf here of the main crate, but I can also help you</p>



<a name="223650067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223650067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223650067">(Jan 22 2021 at 14:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223646259">said</a>:</p>
<blockquote>
<p>need to add timing to <code>render_html</code>, I'm not sure if that time is spent on actual IO or just lots of memory allocations</p>
</blockquote>
<p>working on this now, it's pretty easy, just time consuming</p>



<a name="223650152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223650152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223650152">(Jan 22 2021 at 14:48)</a>:</h4>
<p>do you know why <code>sess.time</code> only takes &amp;'static str?</p>



<a name="223650183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223650183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223650183">(Jan 22 2021 at 14:48)</a>:</h4>
<p>in particular this gives an error:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="k">mut</span><span class="w"> </span><span class="n">format_renderer</span><span class="p">,</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">krate</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">sess</span><span class="p">.</span><span class="n">time</span><span class="p">(</span><span class="o">&amp;</span><span class="fm">format!</span><span class="p">(</span><span class="s">"create_{}_renderer"</span><span class="p">,</span><span class="w"> </span><span class="n">T</span>::<span class="n">descr</span><span class="p">()),</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">});</span><span class="w"></span>
</code></pre></div>



<a name="223650306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223650306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223650306">(Jan 22 2021 at 14:49)</a>:</h4>
<p>Aha, I want <code>generic_activity_with_args</code></p>



<a name="223651564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223651564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223651564">(Jan 22 2021 at 14:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223648234">said</a>:</p>
<blockquote>
<p>(this would be so much easier with <a href="https://github.com/rust-lang/rust/pull/79540">https://github.com/rust-lang/rust/pull/79540</a>)</p>
</blockquote>
<p>can confirm, rebasing over this made things amazingly faster</p>



<a name="223652441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223652441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223652441">(Jan 22 2021 at 15:04)</a>:</h4>
<p>so this is interesting - <code>render_html</code> takes almost no time on cargo, which I was using as a "representative large code base"</p>



<a name="223652464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223652464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223652464">(Jan 22 2021 at 15:04)</a>:</h4>
<p>it's like .35 seconds out of a 5 second compile</p>



<a name="223926051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926051">(Jan 25 2021 at 16:52)</a>:</h4>
<p>Compiling (a part) of the windows-docs-rs crate with the latest nightly, it looks like the biggest chunk of time is spent in <code>late_resolve_crate</code>. Unfortunately, when I build the compiler locally, I get a panic when building the crate so I can't do further testing of what's taking a long amount of time</p>



<a name="223926120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926120">(Jan 25 2021 at 16:52)</a>:</h4>
<p>oh interesting, what panic?</p>



<a name="223926234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926234">(Jan 25 2021 at 16:53)</a>:</h4>
<blockquote>
<p>panicked at 'attempt to create unaligned or null slice', C:\Users\ryanl\Code\rust\library\core\src\slice\raw.rs:90:5</p>
</blockquote>



<a name="223926353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926353">(Jan 25 2021 at 16:54)</a>:</h4>
<p>Looks like somewhere we're passing an unaligned or null pointer to <code>slice::from_raw_parts</code>.</p>



<a name="223926396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926396">(Jan 25 2021 at 16:54)</a>:</h4>
<p>No idea yet why this is happening locally and not on nightly. I will do a bisect</p>



<a name="223926444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926444">(Jan 25 2021 at 16:55)</a>:</h4>
<p>oh huh this must be <a href="https://github.com/microsoft/windows-rs/issues/422">https://github.com/microsoft/windows-rs/issues/422</a></p>



<a name="223926553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926553">(Jan 25 2021 at 16:55)</a>:</h4>
<p>Hmm, yes that looks like it.</p>



<a name="223926677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926677">(Jan 25 2021 at 16:56)</a>:</h4>
<p>this is probably a bug in windows-rs, but you could ignore it for now with <code>debug-assertions = false</code></p>



<a name="223926809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223926809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223926809">(Jan 25 2021 at 16:57)</a>:</h4>
<p>Ah yes, the point about <code>debug_assert</code> is right.</p>



<a name="223927444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223927444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223927444">(Jan 25 2021 at 17:01)</a>:</h4>
<p>Looks like it's an issue in <code>Blob::read_utf16</code> in the windows metadata parser that windows-rs uses</p>



<a name="223927543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223927543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223927543">(Jan 25 2021 at 17:01)</a>:</h4>
<p>I wonder if that assert should happen even in release mode</p>



<a name="223927634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223927634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223927634">(Jan 25 2021 at 17:02)</a>:</h4>
<p>The performance hit is way too big for that.</p>



<a name="223929019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223929019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223929019">(Jan 25 2021 at 17:10)</a>:</h4>
<p>It's an unsafe function, it's part of the contract to only send aligned pointers, so I don't think asserting should happen in release mode</p>



<a name="223929059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223929059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223929059">(Jan 25 2021 at 17:10)</a>:</h4>
<p>it's also part of the standard library, so we would need <code>cargo -Z build-std</code> to have it enabled conditionally</p>



<a name="223929069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223929069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223929069">(Jan 25 2021 at 17:10)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> in the meantime, do you mind running self-profile with a nightly so the debug assertion doesn't trigger? I'm curious to see where the time is being spent</p>



<a name="223929332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223929332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223929332">(Jan 25 2021 at 17:12)</a>:</h4>
<p>Yep, I'll do that</p>



<a name="223935794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223935794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223935794">(Jan 25 2021 at 17:59)</a>:</h4>
<p>So the LateResolveVisitor takes a bunch of time in the following methods: <a href="https://github.com/rust-lang/rust/blob/84864bfea9c00fb90a1fa6e3af1d8ad52ce8f9ec/compiler/rustc_resolve/src/late.rs#L464-L483"><code>visit_ty</code></a> (10.5% of time), <a href="https://github.com/rust-lang/rust/blob/84864bfea9c00fb90a1fa6e3af1d8ad52ce8f9ec/compiler/rustc_resolve/src/late.rs#L512-L550"><code>visit_function</code></a> (4.7% of time), and <a href="https://github.com/rust-lang/rust/blob/84864bfea9c00fb90a1fa6e3af1d8ad52ce8f9ec/compiler/rustc_resolve/src/late.rs#L429-L435"><code>visit_item</code></a> (3.3% of time).</p>



<a name="223938083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938083">(Jan 25 2021 at 18:16)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> would be the one to ask about that I think</p>



<a name="223938137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938137">(Jan 25 2021 at 18:17)</a>:</h4>
<p>Can you post the flamegraph? I'm curious where the other time is spent, 50 minutes is a <em>long</em> time</p>



<a name="223938174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938174">(Jan 25 2021 at 18:17)</a>:</h4>
<p>I've not be able to successfully create flamegraphs on Windows unfortunately...</p>



<a name="223938215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938215">(Jan 25 2021 at 18:17)</a>:</h4>
<p>Ok, if you can post the .mm_profdata file that works too</p>



<a name="223938272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938272">(Jan 25 2021 at 18:18)</a>:</h4>
<p>I can generate the flamegraph and post it</p>



<a name="223938503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938503">(Jan 25 2021 at 18:19)</a>:</h4>
<p>In particular it's resolving path's that's taking a long time in <code>visit_ty</code>: <a href="https://github.com/rust-lang/rust/blob/84864bfea9c00fb90a1fa6e3af1d8ad52ce8f9ec/compiler/rustc_resolve/src/late.rs#L468">https://github.com/rust-lang/rust/blob/84864bfea9c00fb90a1fa6e3af1d8ad52ce8f9ec/compiler/rustc_resolve/src/late.rs#L468</a></p>



<a name="223938540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223938540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223938540">(Jan 25 2021 at 18:20)</a>:</h4>
<p>Basically all of the time in <code>visit_ty</code></p>



<a name="223939252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939252">(Jan 25 2021 at 18:25)</a>:</h4>
<p>/me  works on uploading the profdata file</p>



<a name="223939306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939306">(Jan 25 2021 at 18:25)</a>:</h4>
<p>@kennykerr just put it on onedrive, that worked well</p>



<a name="223939731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939731">(Jan 25 2021 at 18:28)</a>:</h4>
<p><a href="https://www.dropbox.com/s/6r145l1cvjtc2i3/bindings-7288.mm_profdata?dl=0">https://www.dropbox.com/s/6r145l1cvjtc2i3/bindings-7288.mm_profdata?dl=0</a></p>



<a name="223939755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939755">(Jan 25 2021 at 18:28)</a>:</h4>
<p>/me points it on Dropbox like a bad Microsoft employee</p>



<a name="223939791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939791">(Jan 25 2021 at 18:28)</a>:</h4>
<blockquote>
<p>.mm_profdata files can’t be previewed.</p>
</blockquote>
<p>shocking</p>



<a name="223939837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223939837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223939837">(Jan 25 2021 at 18:29)</a>:</h4>
<p>WHY NOT?! <span aria-label="stuck out tongue closed eyes" class="emoji emoji-1f61d" role="img" title="stuck out tongue closed eyes">:stuck_out_tongue_closed_eyes:</span></p>



<a name="223943388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223943388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223943388">(Jan 25 2021 at 18:58)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> let me know when you have a flame graph to look at. I'm signing off for the evening</p>



<a name="223943418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223943418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223943418">(Jan 25 2021 at 18:58)</a>:</h4>
<p>I ran out of time, sorry, I'll have it up by tomorrow</p>



<a name="223943923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223943923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223943923">(Jan 25 2021 at 19:01)</a>:</h4>
<p>let's see how long it will take</p>



<a name="223944161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223944161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223944161">(Jan 25 2021 at 19:03)</a>:</h4>
<p>actually, I get a 43k flamegraph so I guess that's not a success <span aria-label="confused" class="emoji emoji-1f615" role="img" title="confused">:confused:</span></p>



<a name="223944366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223944366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223944366">(Jan 25 2021 at 19:04)</a>:</h4>
<p><a href="/user_uploads/4715/AbJPeRRB8jF8zum7jVwmb1iG/rustc.svg">rustc.svg</a> just in case this really is the flamegraph I'm supposed to get here</p>



<a name="223944427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223944427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223944427">(Jan 25 2021 at 19:05)</a>:</h4>
<p>I won't try to upload the 1.5G <code>chrome_profiler.json</code> though <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span> Loading that actually crashed my chrome, LOL</p>



<a name="223945733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223945733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223945733">(Jan 25 2021 at 19:15)</a>:</h4>
<p>"robust software"</p>



<a name="223946104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223946104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223946104">(Jan 25 2021 at 19:18)</a>:</h4>
<p>yes, that looks right</p>



<a name="223946146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223946146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223946146">(Jan 25 2021 at 19:18)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> that looks like timing for building windows-rs, not windows-docs-rs, I see lots of LLVM codegen but no <code>collect_blanket_impls</code></p>



<a name="223946741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223946741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223946741">(Jan 25 2021 at 19:23)</a>:</h4>
<p>(or maybe you ran <code>cargo rustc</code> instead of <code>cargo rustdoc</code>)</p>



<a name="223946945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223946945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223946945">(Jan 25 2021 at 19:24)</a>:</h4>
<p>Ah yes, sorry, this was for compiling. I can also run rustdoc</p>



<a name="223947005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223947005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223947005">(Jan 25 2021 at 19:24)</a>:</h4>
<p>be warned it will likely take a lot longer :/ <code>collect_blanket_impls</code> is <em>really</em> slow</p>



<a name="223947344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223947344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223947344">(Jan 25 2021 at 19:27)</a>:</h4>
<p>Ah I need to build rustdoc locally. How do I do that?</p>



<a name="223947369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223947369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223947369">(Jan 25 2021 at 19:27)</a>:</h4>
<p><code>x.py build</code> should work</p>



<a name="223947408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223947408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223947408">(Jan 25 2021 at 19:27)</a>:</h4>
<p>or if that gives you trouble, <code>x.py build --stage 1 library/std src/tools/rustdoc</code></p>



<a name="223954017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223954017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223954017">(Jan 25 2021 at 20:17)</a>:</h4>
<p><a href="https://www.dropbox.com/s/ezcvnhvntj8204s/bindings-18880.mm_profdata?dl=0">https://www.dropbox.com/s/ezcvnhvntj8204s/bindings-18880.mm_profdata?dl=0</a></p>
<div class="message_inline_ref"><a href="https://www.dropbox.com/s/ezcvnhvntj8204s/bindings-18880.mm_profdata?dl=0" title="bindings-18880.mm_profdata"><img src="https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-unknown-large.png"></a><div><div class="message_inline_image_title">bindings-18880.mm_profdata</div><desc class="message_inline_image_desc"></desc></div></div>



<a name="223954237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223954237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223954237">(Jan 25 2021 at 20:19)</a>:</h4>
<p>that's perfect, thanks :)</p>



<a name="223954279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223954279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223954279">(Jan 25 2021 at 20:20)</a>:</h4>
<div class="codehilite"><pre><span></span><code>+-------------------------------------------------+-----------+-----------------+----------+------------+
| Item                                            | Self time | % of total time | Time     | Item count |
+-------------------------------------------------+-----------+-----------------+----------+------------+
| get_blanket_impls                               | 32.86s    | 21.799          | 38.02s   | 18683      |
+-------------------------------------------------+-----------+-----------------+----------+------------+
| late_resolve_visit_ty_path                      | 28.24s    | 18.735          | 28.24s   | 534300     |
+-------------------------------------------------+-----------+-----------------+----------+------------+
| render_item                                     | 21.22s    | 14.081          | 21.44s   | 28092      |
+-------------------------------------------------+-----------+-----------------+----------+------------+
| late_resolve_visit_function                     | 12.61s    | 8.366           | 20.15s   | 89046      |
+-------------------------------------------------+-----------+-----------------+----------+------------+
</code></pre></div>
<p>yeah that looks about right</p>



<a name="223954354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223954354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223954354">(Jan 25 2021 at 20:20)</a>:</h4>
<p>I'm surprised <code>render_mod_item</code> is so low on the list, that's interesting</p>



<a name="223954804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223954804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223954804">(Jan 25 2021 at 20:24)</a>:</h4>
<p><a href="/user_uploads/4715/c1lE8QyXyldIZkJNAZvQDkZt/bindings-18880.svg">bindings-18880.svg</a></p>



<a name="223955056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955056">(Jan 25 2021 at 20:27)</a>:</h4>
<p>hmm, it's really strange this is so much faster on your computer than on kennykerr's</p>



<a name="223955064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955064">(Jan 25 2021 at 20:27)</a>:</h4>
<p>it took like 50 minutes for him, it's only like 2.5 minutes for you</p>



<a name="223955133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955133">(Jan 25 2021 at 20:28)</a>:</h4>
<p>swapping is a hell of a perf killer, maybe not enough memory?</p>



<a name="223955159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955159">(Jan 25 2021 at 20:28)</a>:</h4>
<p>25x though?</p>



<a name="223955191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955191">(Jan 25 2021 at 20:28)</a>:</h4>
<p>that's another thing to track though, memory usage</p>



<a name="223955212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955212">(Jan 25 2021 at 20:28)</a>:</h4>
<p>self-profile doesn't record it right now <a href="https://github.com/rust-lang/rust/issues/81348">https://github.com/rust-lang/rust/issues/81348</a></p>



<a name="223955539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955539">(Jan 25 2021 at 20:31)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> sorry to keep bugging you - can you record with <code>-Z times-passes</code> and record the output? I think that's the only way to measure memory usage currently</p>



<a name="223955561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955561">(Jan 25 2021 at 20:31)</a>:</h4>
<p>times-passes does, does rustdoc print some of that? ah I was too slow</p>



<a name="223955569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955569">(Jan 25 2021 at 20:31)</a>:</h4>
<p>(if it's too late there feel free to wait until tomorrow)</p>



<a name="223955582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955582">(Jan 25 2021 at 20:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="334260">Dániel Buga</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223955561">said</a>:</p>
<blockquote>
<p>times-passes does, does rustdoc print some of that?</p>
</blockquote>
<p>yes, time-passes works fine with rustdoc</p>



<a name="223955633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223955633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223955633">(Jan 25 2021 at 20:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223938174">said</a>:</p>
<blockquote>
<p>I've not be able to successfully create flamegraphs on Windows unfortunately...</p>
</blockquote>
<p>FWIW it works fine for me on WSL on that latest mm_profdata file</p>



<a name="223956933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223956933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223956933">(Jan 25 2021 at 20:41)</a>:</h4>
<p>All right let me try a build "quick"</p>
<p>This will be fun</p>
<div class="codehilite"><pre><span></span><code>time: 0.000; rss: 17MB  crate_injection
time: 23.508; rss: 7036MB       expand_crate
</code></pre></div>
<p>time-passes really needs some nesting visualization, though</p>



<a name="223957287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957287">(Jan 25 2021 at 20:44)</a>:</h4>
<p>Oh yeah it will go up over 18 GB</p>



<a name="223957791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957791">(Jan 25 2021 at 20:48)</a>:</h4>
<p>Well whatever is happening, it's happening on a single thread, which is ... well my PC feels sad</p>



<a name="223957804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957804">(Jan 25 2021 at 20:49)</a>:</h4>
<p>well this looks suspicious: <a href="https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/formats/renderer.rs#L111">https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/formats/renderer.rs#L111</a></p>



<a name="223957856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957856">(Jan 25 2021 at 20:49)</a>:</h4>
<p>I hope that's an Rc</p>



<a name="223957897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957897">(Jan 25 2021 at 20:49)</a>:</h4>
<p>I don't think so</p>



<a name="223957980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223957980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223957980">(Jan 25 2021 at 20:50)</a>:</h4>
<p><code>time: 353.758; rss: 8746MB      late_resolve_crate</code> that took forever</p>



<a name="223958463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223958463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223958463">(Jan 25 2021 at 20:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223957897">said</a>:</p>
<blockquote>
<p>I don't think so</p>
</blockquote>
<p>Most of the fields are, though: <a href="https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/html/render/mod.rs#L104L125">https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/html/render/mod.rs#L104L125</a></p>



<a name="223960457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223960457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223960457">(Jan 25 2021 at 21:08)</a>:</h4>
<p>Looks like the call in <code>visit_ty</code> to <code>smart_resolve_path</code> finishes quickly it just runs a lot of time. 534,500 times. That would put it at .05 ms per invocation.</p>



<a name="223960684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223960684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223960684">(Jan 25 2021 at 21:10)</a>:</h4>
<p>Just like typeck and keccak - a single check is ~100us, but it runs 53k times. Anyhow, I had to restart the collection because my terminal got clogged by <br>
<code>time: 0.000; rss: 21409MB       build_local_trait_impl</code></p>
<p>Let's hope redirecting to a file does better.</p>



<a name="223964244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223964244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223964244">(Jan 25 2021 at 21:38)</a>:</h4>
<p>30 minutes later I have a 1.2GB terminal output <span aria-label="open mouth" class="emoji emoji-1f62e" role="img" title="open mouth">:open_mouth:</span> I hope zulip can handle that <a href="/user_uploads/4715/Mf4_d_OguVlV56Lvb48zsRcq/log.txt.gz">log.txt.gz</a></p>



<a name="223964575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223964575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223964575">(Jan 25 2021 at 21:41)</a>:</h4>
<p>(deleted)</p>



<a name="223964891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223964891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223964891">(Jan 25 2021 at 21:44)</a>:</h4>
<p>Trimmed it a bit:</p>
<div class="codehilite"><pre><span></span><code>time: 0.000; rss: 16MB  parse_crate
time: 0.000; rss: 16MB  attributes_injection
time: 0.000; rss: 16MB  recursion_limit
time: 0.000; rss: 16MB  plugin_loading
time: 0.000; rss: 16MB  plugin_registration
time: 0.000; rss: 16MB  pre_AST_expansion_lint_checks
time: 0.000; rss: 17MB  crate_injection
time: 23.541; rss: 7035MB   expand_crate
time: 0.000; rss: 7035MB    check_unused_macros
time: 23.541; rss: 7035MB   macro_expand_crate
time: 0.000; rss: 7035MB    maybe_building_test_harness
time: 1.360; rss: 7035MB    AST_validation
time: 0.000; rss: 7035MB    maybe_create_a_macro_crate
time: 0.002; rss: 7035MB    finalize_imports
time: 0.065; rss: 7030MB    finalize_macro_resolutions
time: 350.582; rss: 8745MB  late_resolve_crate
time: 0.685; rss: 8745MB    resolve_check_unused
time: 0.000; rss: 8745MB    resolve_report_errors
time: 0.648; rss: 8745MB    resolve_postprocess
time: 351.982; rss: 8745MB  resolve_crate
time: 1.196; rss: 8745MB    complete_gated_feature_checking
time: 378.079; rss: 8745MB  configure_and_expand
time: 0.000; rss: 8745MB    load_extern_crates
time: 0.000; rss: 8745MB    prepare_outputs
time: 14.825; rss: 11835MB  hir_lowering
time: 1.792; rss: 11841MB   early_lint_checks
time: 0.180; rss: 12089MB   setup_global_ctxt
time: 0.181; rss: 12089MB   create_global_ctxt
time: 478.438; rss: 15081MB item_types_checking
time: 15.630; rss: 15497MB  crate_lints
time: 0.000; rss: 15497MB   module_lints
time: 15.630; rss: 15497MB  missing_docs
time: 1.906; rss: 15550MB   check_mod_attrs
time: 4.949; rss: 17158MB   clean_crate
time: 0.001; rss: 17158MB   get_auto_trait_impls
time: 0.005; rss: 17159MB   get_blanket_impls
time: 0.006; rss: 17159MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 17159MB   get_auto_trait_impls
time: 0.002; rss: 17159MB   get_blanket_impls
time: 0.002; rss: 17159MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 17159MB   get_auto_trait_impls
time: 0.002; rss: 17159MB   get_blanket_impls
time: 0.002; rss: 17159MB   get_auto_trait_and_blanket_synthetic_impls
[.. 135k lines ...]
time: 0.000; rss: 20308MB   get_auto_trait_impls
time: 0.001; rss: 20308MB   get_blanket_impls
time: 0.002; rss: 20308MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 20308MB   get_auto_trait_impls
time: 0.001; rss: 20308MB   get_blanket_impls
time: 0.002; rss: 20308MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 20308MB   get_auto_trait_impls
time: 0.001; rss: 20308MB   get_blanket_impls
time: 0.002; rss: 20308MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 20308MB   get_auto_trait_impls
time: 0.001; rss: 20308MB   get_blanket_impls
time: 0.002; rss: 20308MB   get_auto_trait_and_blanket_synthetic_impls
time: 0.000; rss: 20308MB   get_auto_trait_impls
time: 0.001; rss: 20308MB   get_blanket_impls
time: 0.002; rss: 20308MB   get_auto_trait_and_blanket_synthetic_impls
time: 75.814; rss: 20308MB  collect_synthetic_impls
time: 0.199; rss: 20394MB   collect_items_for_trait_impls
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20394MB   build_extern_trait_impl
[... around 15k repetitions ...]
time: 0.000; rss: 20394MB   build_extern_trait_impl
time: 0.000; rss: 20508MB   get_auto_trait_impls
time: 0.002; rss: 20508MB   get_blanket_impls
time: 0.006; rss: 20508MB   build_primitive_trait_impl
time: 0.000; rss: 20508MB   get_auto_trait_impls
time: 0.002; rss: 20508MB   get_blanket_impls
time: 0.002; rss: 20508MB   build_primitive_trait_impl
time: 0.000; rss: 20508MB   get_auto_trait_impls
time: 0.002; rss: 20508MB   get_blanket_impls
time: 0.002; rss: 20508MB   build_primitive_trait_impl
time: 0.000; rss: 20508MB   get_auto_trait_impls
time: 0.002; rss: 20508MB   get_blanket_impls
time: 0.002; rss: 20508MB   build_primitive_trait_impl
time: 0.000; rss: 20508MB   get_auto_trait_impls
time: 0.001; rss: 20508MB   get_blanket_impls
time: 0.001; rss: 20508MB   build_primitive_trait_impl
time: 0.000; rss: 20509MB   get_auto_trait_impls
time: 0.001; rss: 20509MB   get_blanket_impls
time: 0.003; rss: 20509MB   build_primitive_trait_impl
time: 0.000; rss: 20509MB   get_auto_trait_impls
time: 0.002; rss: 20509MB   get_blanket_impls
time: 0.005; rss: 20509MB   build_primitive_trait_impl
time: 0.000; rss: 20510MB   get_auto_trait_impls
time: 0.002; rss: 20510MB   get_blanket_impls
time: 0.005; rss: 20510MB   build_primitive_trait_impl
time: 0.000; rss: 20511MB   get_auto_trait_impls
time: 0.002; rss: 20511MB   get_blanket_impls
time: 0.005; rss: 20511MB   build_primitive_trait_impl
time: 0.000; rss: 20511MB   get_auto_trait_impls
time: 0.002; rss: 20511MB   get_blanket_impls
time: 0.005; rss: 20511MB   build_primitive_trait_impl
time: 0.000; rss: 20511MB   get_auto_trait_impls
time: 0.001; rss: 20511MB   get_blanket_impls
time: 0.002; rss: 20511MB   build_primitive_trait_impl
time: 0.000; rss: 20511MB   get_auto_trait_impls
time: 0.001; rss: 20511MB   get_blanket_impls
time: 0.001; rss: 20511MB   build_primitive_trait_impl
time: 0.000; rss: 20511MB   get_auto_trait_impls
time: 0.002; rss: 20511MB   get_blanket_impls
time: 0.002; rss: 20511MB   build_primitive_trait_impl
time: 0.000; rss: 20512MB   get_auto_trait_impls
time: 0.001; rss: 20512MB   get_blanket_impls
time: 0.002; rss: 20512MB   build_primitive_trait_impl
time: 0.000; rss: 20512MB   get_auto_trait_impls
time: 0.002; rss: 20513MB   get_blanket_impls
time: 0.005; rss: 20513MB   build_primitive_trait_impl
time: 0.000; rss: 20514MB   get_auto_trait_impls
time: 0.002; rss: 20514MB   get_blanket_impls
time: 0.005; rss: 20514MB   build_primitive_trait_impl
time: 0.000; rss: 20515MB   get_auto_trait_impls
time: 0.002; rss: 20515MB   get_blanket_impls
time: 0.005; rss: 20515MB   build_primitive_trait_impl
time: 0.000; rss: 20515MB   get_auto_trait_impls
time: 0.002; rss: 20515MB   get_blanket_impls
time: 0.005; rss: 20515MB   build_primitive_trait_impl
time: 0.000; rss: 20516MB   get_auto_trait_impls
time: 0.002; rss: 20516MB   get_blanket_impls
time: 0.002; rss: 20516MB   build_primitive_trait_impl
time: 0.000; rss: 20516MB   get_auto_trait_impls
time: 0.002; rss: 20516MB   get_blanket_impls
time: 0.002; rss: 20516MB   build_primitive_trait_impl
time: 0.000; rss: 20516MB   get_auto_trait_impls
time: 0.002; rss: 20516MB   get_blanket_impls
time: 0.002; rss: 20516MB   build_primitive_trait_impl
time: 0.000; rss: 20516MB   get_auto_trait_impls
time: 0.002; rss: 20516MB   get_blanket_impls
time: 0.002; rss: 20516MB   build_primitive_trait_impl
time: 0.000; rss: 20517MB   get_auto_trait_impls
time: 0.003; rss: 20517MB   get_blanket_impls
time: 0.004; rss: 20517MB   build_primitive_trait_impl
time: 0.000; rss: 20517MB   get_auto_trait_impls
time: 0.001; rss: 20517MB   get_blanket_impls
time: 0.002; rss: 20517MB   build_primitive_trait_impl
time: 0.000; rss: 20517MB   get_auto_trait_impls
time: 0.002; rss: 20517MB   get_blanket_impls
time: 0.002; rss: 20517MB   build_primitive_trait_impl
time: 0.000; rss: 20517MB   get_auto_trait_impls
time: 0.001; rss: 20517MB   get_blanket_impls
time: 0.002; rss: 20517MB   build_primitive_trait_impl
time: 0.000; rss: 20518MB   get_auto_trait_impls
time: 0.002; rss: 20518MB   get_blanket_impls
time: 0.005; rss: 20518MB   build_primitive_trait_impl
time: 0.000; rss: 20518MB   get_auto_trait_impls
time: 0.002; rss: 20518MB   get_blanket_impls
time: 0.005; rss: 20518MB   build_primitive_trait_impl
time: 0.000; rss: 20519MB   get_auto_trait_impls
time: 0.002; rss: 20519MB   get_blanket_impls
time: 0.005; rss: 20519MB   build_primitive_trait_impl
time: 0.000; rss: 20519MB   build_local_trait_impl
[... around 12 million lines ...]
time: 0.000; rss: 21548MB   build_local_trait_impl
time: 0.000; rss: 21548MB   build_local_trait_impl
time: 0.000; rss: 21548MB   build_local_trait_impl
time: 0.000; rss: 21548MB   build_local_trait_impl
time: 354.213; rss: 21538MB collect-trait-impls
time: 0.654; rss: 21538MB   unindent-comments
time: 1.507; rss: 21538MB   check-private-items-doc-tests
time: 1.824; rss: 21539MB   strip-hidden
time: 1.567; rss: 21539MB   strip-private
time: 1.466; rss: 21540MB   collect-intra-doc-links
time: 0.616; rss: 21540MB   check-code-block-syntax
time: 0.657; rss: 21540MB   check-invalid-html-tags
time: 0.610; rss: 21540MB   propagate-doc-cfg
time: 0.659; rss: 21541MB   check-non-autolinks
time: 865.017; rss: 19551MB run_global_ctxt
time: 6.120; rss: 21144MB   create_format_cache
time: 2.049; rss: 21149MB   create_renderer(html)
time: 0.093; rss: 21324MB   renderer_after_krate(html)
time: 311.517; rss: 21322MB render_html
time: 9.426; rss: 7173MB    free_global_ctxt
</code></pre></div>



<a name="223965924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223965924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223965924">(Jan 25 2021 at 21:53)</a>:</h4>
<p>oh sorry I forgot that <a href="https://github.com/rust-lang/rust/pull/81284">https://github.com/rust-lang/rust/pull/81284</a> hasn't been merged yet</p>



<a name="223965957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223965957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223965957">(Jan 25 2021 at 21:53)</a>:</h4>
<p>wow, that's 7 GB just from macros expansion</p>



<a name="223965995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223965995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223965995">(Jan 25 2021 at 21:53)</a>:</h4>
<p>another  1.8 GB for resolve, 3 GB for HIR lowering ... wow</p>



<a name="223966079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966079">(Jan 25 2021 at 21:54)</a>:</h4>
<p>yeah <em>just</em> rustc, without running <code>clean</code> even, is already 15.5 GB</p>



<a name="223966105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966105">(Jan 25 2021 at 21:54)</a>:</h4>
<p>and then clean adds another 1.5 GB on top and get_blanket_impls is 4 GB on top of that</p>



<a name="223966110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966110">(Jan 25 2021 at 21:54)</a>:</h4>
<p>jesus</p>



<a name="223966250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966250">(Jan 25 2021 at 21:56)</a>:</h4>
<p>I'll spend some time tomorrow and clean out some unnecessary allocations, I bet some of those hurt if done 12 million times</p>



<a name="223966403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966403">(Jan 25 2021 at 21:57)</a>:</h4>
<p>But that's like a 100 bytes per build_local_trait_impl or so?</p>



<a name="223966432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966432">(Jan 25 2021 at 21:57)</a>:</h4>
<p>yeah, that's about the size of clean::Item</p>



<a name="223966454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966454">(Jan 25 2021 at 21:57)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustdoc/clean/types.rs.html#92">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustdoc/clean/types.rs.html#92</a></p>



<a name="223966497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966497">(Jan 25 2021 at 21:57)</a>:</h4>
<p>It would be 8 bytes smaller if I could ever get <a href="https://github.com/rust-lang/rust/pull/80339">https://github.com/rust-lang/rust/pull/80339</a> to work</p>



<a name="223966693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966693">(Jan 25 2021 at 21:59)</a>:</h4>
<p>hmm actually I could make it <em>significantly</em> smaller by using the same Box for all the fields</p>



<a name="223966787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223966787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223966787">(Jan 25 2021 at 22:00)</a>:</h4>
<p>like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">crate</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Item</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">def_id</span>: <span class="nc">DefId</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">inner</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="n">ItemInner</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">crate</span><span class="w"> </span><span class="k">struct</span> <span class="nc">ItemInner</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Stringified span</span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">source</span>: <span class="nc">Span</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Not everything has a name. E.g., impls</span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">name</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="n">Symbol</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">attrs</span>: <span class="nc">Attributes</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">visibility</span>: <span class="nc">Visibility</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="n">kind</span>: <span class="nc">ItemKind</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="223967080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967080">(Jan 25 2021 at 22:00)</a>:</h4>
<p>Does that <em>need</em> to be boxed at all?</p>



<a name="223967123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967123">(Jan 25 2021 at 22:00)</a>:</h4>
<p>there will be some balancing needed for frequently accessed fields</p>



<a name="223967334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967334">(Jan 25 2021 at 22:01)</a>:</h4>
<p><code>name</code> and <code>kind</code> are probably the most frequently accessed and kind is already boxed</p>



<a name="223967428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967428">(Jan 25 2021 at 22:02)</a>:</h4>
<p>and none of the perf-sensitive parts of rustdoc use anything other than the DefId</p>



<a name="223967463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967463">(Jan 25 2021 at 22:02)</a>:</h4>
<p>You'll allocate the memory anyway, so technically that box is 8 bytes as well. If inlining the whole struct doesn't hurt, don't add a level of indirection. Are there measurements for that?</p>



<a name="223967513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967513">(Jan 25 2021 at 22:02)</a>:</h4>
<p>(perf-sensitive -&gt; collect_blanket_impls)</p>



<a name="223967594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967594">(Jan 25 2021 at 22:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="334260">Dániel Buga</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223967463">said</a>:</p>
<blockquote>
<p>You'll allocate the memory anyway, so technically that box is 8 bytes as well. If inlining the whole struct doesn't hurt, don't add a level of indirection. Are there measurements for that?</p>
</blockquote>
<p>right, but that way it's not using 3 different boxes like it is now</p>



<a name="223967642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967642">(Jan 25 2021 at 22:02)</a>:</h4>
<p>true</p>



<a name="223967790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967790">(Jan 25 2021 at 22:03)</a>:</h4>
<p>anyway, I think it would be more helpful to figure out why just expanding macros uses 7 GB of memory (!!)</p>



<a name="223967844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223967844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223967844">(Jan 25 2021 at 22:03)</a>:</h4>
<p>maybe there are a lot? <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="223968043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968043">(Jan 25 2021 at 22:04)</a>:</h4>
<p>Those 7GB, how much is in the rustc HIR, and how much in rustdoc's version?</p>



<a name="223968090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968090">(Jan 25 2021 at 22:04)</a>:</h4>
<p><span class="user-mention" data-user-id="248906">@cjgillot</span> rustdoc hasn't done anything at all at this point</p>



<a name="223968146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968146">(Jan 25 2021 at 22:05)</a>:</h4>
<p>Oh, that bad.</p>



<a name="223968301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968301">(Jan 25 2021 at 22:05)</a>:</h4>
<p>I think this is in the global_ctxt() call: <a href="https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/lib.rs#L551">https://github.com/rust-lang/rust/blob/7fba12bb1d3877870758a7a53e2fe766bb19bd60/src/librustdoc/lib.rs#L551</a></p>



<a name="223968425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968425">(Jan 25 2021 at 22:06)</a>:</h4>
<p>so literally the only thing that's not straight from the compiler is loading extern crates, and I don't think windows-rs has many dependencies</p>



<a name="223968446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223968446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223968446">(Jan 25 2021 at 22:06)</a>:</h4>
<p>certainly not 7 GB worth</p>



<a name="223969022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223969022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223969022">(Jan 25 2021 at 22:09)</a>:</h4>
<p>Calling <code>global_ctxt()</code> ensures everything is done from parsing to HIR lowering. What are those macros oO</p>



<a name="223969137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223969137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223969137">(Jan 25 2021 at 22:09)</a>:</h4>
<p>this is <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/expand/struct.MacroExpander.html#method.expand_crate">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/expand/struct.MacroExpander.html#method.expand_crate</a> FYI</p>



<a name="223969593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223969593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223969593">(Jan 25 2021 at 22:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="248906">cjgillot</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223969022">said</a>:</p>
<blockquote>
<p>Calling <code>global_ctxt()</code> ensures everything is done from parsing to HIR lowering. What are those macros oO</p>
</blockquote>
<p>the whole crate is just a <a href="http://build.rs">build.rs</a> and one line:<br>
<a href="https://github.com/microsoft/windows-docs-rs/blob/c105bd478d8750cb785a8ac8654ed0dee527495c/crates/bindings/build.rs">https://github.com/microsoft/windows-docs-rs/blob/c105bd478d8750cb785a8ac8654ed0dee527495c/crates/bindings/build.rs</a><br>
<a href="https://github.com/microsoft/windows-docs-rs/blob/c105bd478d8750cb785a8ac8654ed0dee527495c/crates/bindings/src/lib.rs">https://github.com/microsoft/windows-docs-rs/blob/c105bd478d8750cb785a8ac8654ed0dee527495c/crates/bindings/src/lib.rs</a></p>



<a name="223969789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223969789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223969789">(Jan 25 2021 at 22:13)</a>:</h4>
<p><a href="https://github.com/microsoft/windows-rs/blob/256538e85f2f9c860c09c318423b3be79b36b9c3/src/macros.rs#L5">https://github.com/microsoft/windows-rs/blob/256538e85f2f9c860c09c318423b3be79b36b9c3/src/macros.rs#L5</a></p>



<a name="223969928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223969928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223969928">(Jan 25 2021 at 22:13)</a>:</h4>
<p>the whole crate is "just" a giant include</p>



<a name="223970104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970104">(Jan 25 2021 at 22:14)</a>:</h4>
<p>this is <code>build!</code>: <a href="https://github.com/microsoft/windows-rs/blob/256538e85f2f9c860c09c318423b3be79b36b9c3/crates/macros/src/lib.rs#L37">https://github.com/microsoft/windows-rs/blob/256538e85f2f9c860c09c318423b3be79b36b9c3/crates/macros/src/lib.rs#L37</a></p>



<a name="223970184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970184">(Jan 25 2021 at 22:15)</a>:</h4>
<p>so I guess the helpful thing to do is find what's in <code>windows.rs</code> that it generates, I would expect compiling that to be platform independent (since rustdoc doesn't try to link it)</p>



<a name="223970250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970250">(Jan 25 2021 at 22:15)</a>:</h4>
<p><span class="user-mention" data-user-id="334260">@Dániel Buga</span> can you upload that?</p>



<a name="223970478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970478">(Jan 25 2021 at 22:16)</a>:</h4>
<p>Lemme find it</p>



<a name="223970507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970507">(Jan 25 2021 at 22:17)</a>:</h4>
<p>it will be in OUT_DIR somewhere, you can find it with <code>fd windows.rs target/</code></p>



<a name="223970585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970585">(Jan 25 2021 at 22:17)</a>:</h4>
<p><a href="/user_uploads/4715/5pVdMO4NBYzUlGsgD1OJ_F-g/windows.rs">windows.rs</a> Maybe this one</p>



<a name="223970794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970794">(Jan 25 2021 at 22:18)</a>:</h4>
<p>hmm kenny said it was 300 MB <a href="https://github.com/microsoft/windows-rs/issues/420#issuecomment-764997878">https://github.com/microsoft/windows-rs/issues/420#issuecomment-764997878</a></p>



<a name="223970934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970934">(Jan 25 2021 at 22:18)</a>:</h4>
<p>Well the timestamp is old as well so maybe not</p>



<a name="223970955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223970955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223970955">(Jan 25 2021 at 22:19)</a>:</h4>
<p>aha, found it</p>



<a name="223971013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971013">(Jan 25 2021 at 22:19)</a>:</h4>
<p>similar structure, just a bit longer, sec and I'll upload</p>



<a name="223971065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971065">(Jan 25 2021 at 22:20)</a>:</h4>
<p>that would let me test locally :)</p>



<a name="223971073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971073">(Jan 25 2021 at 22:20)</a>:</h4>
<p>rustfmt will love that file</p>



<a name="223971163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971163">(Jan 25 2021 at 22:21)</a>:</h4>
<p><a href="/user_uploads/4715/kpqdUSZgwxDI-CwR_kOFQQ7o/image.png">image.png</a> yup</p>
<div class="message_inline_image"><a href="/user_uploads/4715/kpqdUSZgwxDI-CwR_kOFQQ7o/image.png" title="image.png"><img src="/user_uploads/4715/kpqdUSZgwxDI-CwR_kOFQQ7o/image.png"></a></div>



<a name="223971319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971319">(Jan 25 2021 at 22:22)</a>:</h4>
<p><a href="https://drive.google.com/file/d/1RF_EjyAEWmOeRiFgowxh637iVeehK6TJ/view?usp=sharing">https://drive.google.com/file/d/1RF_EjyAEWmOeRiFgowxh637iVeehK6TJ/view?usp=sharing</a> I hope that's the link</p>



<a name="223971381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971381">(Jan 25 2021 at 22:23)</a>:</h4>
<p>that worked, thanks</p>



<a name="223971402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971402">(Jan 25 2021 at 22:23)</a>:</h4>
<p>yw</p>



<a name="223971554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971554">(Jan 25 2021 at 22:24)</a>:</h4>
<p>wow that is a 6 million line file lol</p>



<a name="223971580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971580">(Jan 25 2021 at 22:25)</a>:</h4>
<p>just removing the <code>\r</code> endings would making it significantly smaller <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="223971647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971647">(Jan 25 2021 at 22:25)</a>:</h4>
<p>oh shoot I should've gzipped</p>



<a name="223971651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971651">(Jan 25 2021 at 22:25)</a>:</h4>
<p>nbd</p>



<a name="223971681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971681">(Jan 25 2021 at 22:26)</a>:</h4>
<p>well that's what I do at 11:25pm</p>



<a name="223971722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971722">(Jan 25 2021 at 22:26)</a>:</h4>
<p>lol yup removing \r cuts off 6 megs <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> </p>
<div class="codehilite"><pre><span></span><code>-rw-rw-r-- 1 joshua joshua 285M Jan 25 17:25 windows-modified.rs
-rw-rw-r-- 1 joshua joshua 291M Jan 25 17:23 windows.rs
</code></pre></div>



<a name="223971730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971730">(Jan 25 2021 at 22:26)</a>:</h4>
<p>that's ... expected <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="223971788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223971788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223971788">(Jan 25 2021 at 22:27)</a>:</h4>
<p>So, the gzip is as small as the line endings, lol</p>



<a name="223972115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972115">(Jan 25 2021 at 22:30)</a>:</h4>
<p>Uh I guess some memory can be saved if Item::attrs is a <code>Option&lt;Box&lt;Attributes&gt;&gt;</code>, we allocate a few empty ones I think</p>



<a name="223972193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972193">(Jan 25 2021 at 22:30)</a>:</h4>
<p><span class="user-mention" data-user-id="334260">@Dániel Buga</span> I think optimizing clean::Item is the wrong approach honestly</p>



<a name="223972215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972215">(Jan 25 2021 at 22:31)</a>:</h4>
<p>if rustdoc used <em>zero</em> memory, it would still be using 15 GB from rustc alone</p>



<a name="223972229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972229">(Jan 25 2021 at 22:31)</a>:</h4>
<p>which is impossibly large</p>



<a name="223972253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972253">(Jan 25 2021 at 22:31)</a>:</h4>
<p>Should we gather a strike team to take down rustdoc's custom tree?</p>



<a name="223972370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972370">(Jan 25 2021 at 22:32)</a>:</h4>
<p>And in parallel, find how we can compress rustc's representation.</p>



<a name="223972420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972420">(Jan 25 2021 at 22:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="248906">cjgillot</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223972253">said</a>:</p>
<blockquote>
<p>Should we gather a strike team to take down rustdoc's custom tree?</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/76382">https://github.com/rust-lang/rust/issues/76382</a></p>



<a name="223972439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972439">(Jan 25 2021 at 22:33)</a>:</h4>
<p>Using more memory just to parse and desugar a file, that kind of defeats the purpose of data structures.</p>



<a name="223972445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972445">(Jan 25 2021 at 22:33)</a>:</h4>
<p>yeah I tend to concentrate on the other 6-7GBs usually <span aria-label="rolling on the floor laughing" class="emoji emoji-1f923" role="img" title="rolling on the floor laughing">:rolling_on_the_floor_laughing:</span> I tend to think rustc is complicated enough for me to ignore</p>



<a name="223972551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972551">(Jan 25 2021 at 22:34)</a>:</h4>
<p>(I know a couple <code>clean</code> cleanups are waiting on one PR to make it possible to thread TyCtxt places, and I have some ideas along that line but am also waiting on it)</p>



<a name="223972605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972605">(Jan 25 2021 at 22:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223972420">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="248906">cjgillot</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223972253">said</a>:</p>
<blockquote>
<p>Should we gather a strike team to take down rustdoc's custom tree?</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/76382">https://github.com/rust-lang/rust/issues/76382</a></p>
</blockquote>
<p>I know. Do you have a strategy to solve it? I don't know rustdoc enough to devise one.</p>



<a name="223972646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972646">(Jan 25 2021 at 22:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="319144">CraftSpider</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223972551">said</a>:</p>
<blockquote>
<p>(I know a couple <code>clean</code> cleanups are waiting on one PR to make it possible to thread TyCtxt places, and I have some ideas along that line but am also waiting on it)</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/pull/80883">https://github.com/rust-lang/rust/pull/80883</a></p>



<a name="223972659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972659">(Jan 25 2021 at 22:35)</a>:</h4>
<p>and there are a bunch of related PRs linked from there that should help a lot</p>



<a name="223972662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972662">(Jan 25 2021 at 22:35)</a>:</h4>
<p>Item may not even be the most difficult. The representation of types is very different than rustc's.</p>



<a name="223972752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972752">(Jan 25 2021 at 22:36)</a>:</h4>
<p>I still think looking at <code>clean</code> is not the best approach, 15 GB or 21 is honestly not that much difference when you only have 8 GB RAM</p>



<a name="223972762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972762">(Jan 25 2021 at 22:36)</a>:</h4>
<p>I would rather make expand_crate use less memory</p>



<a name="223972797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> CraftSpider <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972797">(Jan 25 2021 at 22:36)</a>:</h4>
<p>The current strategy (If I remember the plan from the tree of PRs Joshua just linked) is a bunch of smaller PRs which individually start to make various <code>clean</code> items look like the equivalent HIR. Once an item is close enough, then it can mass-replaced pretty easily.</p>



<a name="223972865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223972865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223972865">(Jan 25 2021 at 22:37)</a>:</h4>
<p>the harder thing is figuring out how to make <code>get_blanket_impls</code> take less time</p>



<a name="223974076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223974076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223974076">(Jan 25 2021 at 22:49)</a>:</h4>
<blockquote>
<p>While working on adding more RSS data to the time-passes output, I realized that the RSS increase I spoke of doesn't occur during pre_AST_expansion_lint_checks. That pass is called repeatedly during expand_crate. What looks like an increase during pre_AST_expansion_lint_checks is actually just a reflection of an increase that happened elsewhere during expand_crate.</p>
</blockquote>
<p><span class="user-mention" data-user-id="306073">@Tyson Nottingham</span> right, this is what I meant in <a href="https://github.com/rust-lang/rust/pull/81284#issuecomment-766363831">https://github.com/rust-lang/rust/pull/81284#issuecomment-766363831</a>. But I still think this is useful <em>as</em> a measure of how much memory AST expansion is using</p>



<a name="223974946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223974946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223974946">(Jan 25 2021 at 22:58)</a>:</h4>
<p>oh oof, well that's definitely a place to start, ast::Item is 300 bytes</p>
<div class="codehilite"><pre><span></span><code>error[E0308]: mismatched types
    --&gt; /home/joshua/rustc3/compiler/rustc_data_structures/src/macros.rs:5:32
     |
3    | / macro_rules! static_assert_size {
4    | |     ($ty:ty, $size:expr) =&gt; {
5    | |         const _: [(); $size] = [(); ::std::mem::size_of::&lt;$ty&gt;()];
     | |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 100 elements, found one with 296 elements
6    | |     };
7    | | }
     | |_- in this expansion of `rustc_data_structures::static_assert_size!`
     |
    ::: compiler/rustc_ast/src/ast.rs:2596:1
     |
2596 |   rustc_data_structures::static_assert_size!(Item, 100);
     |   ------------------------------------------------------ in this macro invocation
</code></pre></div>



<a name="223975028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975028">(Jan 25 2021 at 22:59)</a>:</h4>
<p>with <code>ItemKind</code> boxed it's only 96 bytes</p>



<a name="223975183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975183">(Jan 25 2021 at 23:00)</a>:</h4>
<p>margin of error</p>



<a name="223975252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975252">(Jan 25 2021 at 23:01)</a>:</h4>
<p>If you box the whole ItemKind, you still need to allocate the whole ItemKind though so you only added a level of indirection?</p>



<a name="223975299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975299">(Jan 25 2021 at 23:01)</a>:</h4>
<p>right, but any <code>Vec</code> holding it will be a third the size</p>



<a name="223975403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975403">(Jan 25 2021 at 23:02)</a>:</h4>
<p>Uh, won't it be the same size, some of that is just on the heap somewhere else?</p>



<a name="223975441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975441">(Jan 25 2021 at 23:03)</a>:</h4>
<p>if you memcpy the vec, you are memcpying a third of the bytes</p>



<a name="223975479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975479">(Jan 25 2021 at 23:03)</a>:</h4>
<p>that's true</p>



<a name="223975497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975497">(Jan 25 2021 at 23:03)</a>:</h4>
<p>no, that's false, vec is still 12 bytes <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="223975530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975530">(Jan 25 2021 at 23:03)</a>:</h4>
<p>or however much 3 words are nowadays</p>



<a name="223975531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975531">(Jan 25 2021 at 23:03)</a>:</h4>
<p>you know what I mean</p>



<a name="223975616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975616">(Jan 25 2021 at 23:04)</a>:</h4>
<p>yeah, but do you often bitwise copy something like that?</p>



<a name="223975688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975688">(Jan 25 2021 at 23:05)</a>:</h4>
<p><span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> boxing these things worked very well for rustdoc</p>



<a name="223975713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975713">(Jan 25 2021 at 23:05)</a>:</h4>
<p>to save memory, you'll need to identify the biggest variants in ItemKind and box those</p>



<a name="223975728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975728">(Jan 25 2021 at 23:05)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/80014#issuecomment-744064926">https://github.com/rust-lang/rust/pull/80014#issuecomment-744064926</a></p>



<a name="223975780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975780">(Jan 25 2021 at 23:06)</a>:</h4>
<p>that's probabyl cache locality or some other black magic I can't possibly comprehend</p>



<a name="223975864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223975864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223975864">(Jan 25 2021 at 23:06)</a>:</h4>
<p>not to discourage you, it's definitely worth a try</p>



<a name="223976011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223976011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223976011">(Jan 25 2021 at 23:08)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  Do you happen to know why <code>inline::build_impl</code> takes an Option&lt;Attrs&gt; instead of plain Attrs?</p>



<a name="223976105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223976105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223976105">(Jan 25 2021 at 23:09)</a>:</h4>
<p>yes, if it's <code>None</code> then we can save a memcpy: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustdoc/clean/inline.rs.html#306">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustdoc/clean/inline.rs.html#306</a></p>



<a name="223976206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223976206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223976206">(Jan 25 2021 at 23:10)</a>:</h4>
<p>And if it's an empty slice instead?</p>



<a name="223976263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223976263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223976263">(Jan 25 2021 at 23:10)</a>:</h4>
<p><span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> you can combine the representations if you like, I think rustdoc has a logic invariant that it can't be empty though</p>



<a name="223976651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/223976651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#223976651">(Jan 25 2021 at 23:16)</a>:</h4>
<p>Ah it doesn't matter, 16 bytes both ways... well I guess that's for the better</p>



<a name="224032559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224032559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224032559">(Jan 26 2021 at 12:40)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> Sorry for the confusion with perf differences between Kenny's run and mine. I am testing with a smaller subset so that I don't have to wait the full 30 minutes every time I want to test something.</p>



<a name="224034554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224034554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224034554">(Jan 26 2021 at 13:00)</a>:</h4>
<p>That explains it <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="224054109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224054109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224054109">(Jan 26 2021 at 15:22)</a>:</h4>
<p>Re: crate compilation  -I've found some interesting things. On my reduced example, we're accessing the file system at least 191,000 times. It seems that every time we see an extern lib we check to see if that file exists even if we've seen it before. That check alone takes 2% of the compilation time</p>



<a name="224055837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224055837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224055837">(Jan 26 2021 at 15:34)</a>:</h4>
<p>It seems like every time we need to load an external library we do so from scratch even if we've already laded that library before.</p>



<a name="224059279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224059279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224059279">(Jan 26 2021 at 15:55)</a>:</h4>
<p>The <a href="https://github.com/rust-lang/rust/blob/1483e67addd37d9bd20ba3b4613b678ee9ad4d68/compiler/rustc_metadata/src/locator.rs#L659"><code>find_commandline_library</code></a> function gets called over 191,000 times. I would think it really only needs to be called once per unique crate. Still not sure why the <a href="https://github.com/rust-lang/rust/blob/1483e67addd37d9bd20ba3b4613b678ee9ad4d68/compiler/rustc_metadata/src/creader.rs#L221"><code>existing_match</code></a> function seems to return <code>None</code> all the time which causes us to go to the load fallback 191,000 times. That doesn't seem right.</p>



<a name="224060755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224060755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224060755">(Jan 26 2021 at 16:03)</a>:</h4>
<p>That's interesting! Sounds like wouldn't be too difficult to fix it either.</p>



<a name="224072120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224072120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224072120">(Jan 26 2021 at 17:19)</a>:</h4>
<p>Does anyone know why we only check for rlib and dylib sources here and not rmeta? <a href="https://github.com/rust-lang/rust/blob/1483e67addd37d9bd20ba3b4613b678ee9ad4d68/compiler/rustc_metadata/src/creader.rs#L256-L257">https://github.com/rust-lang/rust/blob/1483e67addd37d9bd20ba3b4613b678ee9ad4d68/compiler/rustc_metadata/src/creader.rs#L256-L257</a></p>



<a name="224072789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224072789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224072789">(Jan 26 2021 at 17:24)</a>:</h4>
<p>This code predates addition of rmeta, so I would guess that its just an oversight</p>



<a name="224072807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224072807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224072807">(Jan 26 2021 at 17:24)</a>:</h4>
<p>but I'm not super familiar with crate loading code to say for sure</p>



<a name="224072904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224072904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224072904">(Jan 26 2021 at 17:25)</a>:</h4>
<p>Ok I can add it and see what happens</p>



<a name="224075719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224075719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224075719">(Jan 26 2021 at 17:44)</a>:</h4>
<p>That seems to have worked. It caught off 10 seconds from the build (3.5%)</p>



<a name="224078074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224078074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224078074">(Jan 26 2021 at 17:59)</a>:</h4>
<p>Not sure if this is a fluke, but <code>LLVM_module_codegen_emit_obj</code> regressed...</p>



<a name="224078355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224078355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224078355">(Jan 26 2021 at 18:01)</a>:</h4>
<p>I'm in a video chat. Maybe en/decoding is really hurting things</p>



<a name="224078822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224078822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224078822">(Jan 26 2021 at 18:04)</a>:</h4>
<p>I'm quite sure loading something once instead of a multiple times has no effect on codegen.</p>



<a name="224081264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224081264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224081264">(Jan 26 2021 at 18:22)</a>:</h4>
<p>Yea, I think it was my CPU being occupied with video chat. It looks like the change actually leads to a ~13% improvement (nearly 40 seconds improvement in this latest run)</p>



<a name="224081320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224081320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224081320">(Jan 26 2021 at 18:23)</a>:</h4>
<p>13% for one line of code is not too bad <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="224081365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224081365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224081365">(Jan 26 2021 at 18:23)</a>:</h4>
<p>indeed, congrats <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="224081661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224081661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224081661">(Jan 26 2021 at 18:26)</a>:</h4>
<p>I'm not sure if there is a test I should be updating</p>



<a name="224081872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224081872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224081872">(Jan 26 2021 at 18:27)</a>:</h4>
<p>I defer to the CI's judgement</p>



<a name="224083718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224083718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224083718">(Jan 26 2021 at 18:41)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/81414">https://github.com/rust-lang/rust/pull/81414</a></p>



<a name="224094922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224094922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224094922">(Jan 26 2021 at 20:05)</a>:</h4>
<p>So we're still spending 4.5% percent of time looking into whether we've loaded a crate or not. In particular this is caused by calling <code> std::fs::canonicalize</code> <em>a lot</em> <a href="https://github.com/rust-lang/rust/blob/7907345e58b4f4d2c95e5ea9b8e0b3bff8946523/compiler/rustc_metadata/src/creader.rs#L255">here</a>. In my tests, this is running 191,043 times. Unfortunately, this function does some file system operations which makes it a bit too slow to be called that much. I'll look into pre-cononcalizing these paths.</p>



<a name="224096126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224096126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dániel Buga <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224096126">(Jan 26 2021 at 20:13)</a>:</h4>
<p>How do you count fs operations?</p>



<a name="224097836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224097836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224097836">(Jan 26 2021 at 20:26)</a>:</h4>
<p>I'm not specifically. I just was tracking the code path where that is called with a <code>verbose_generic_activity</code></p>



<a name="224097959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224097959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224097959">(Jan 26 2021 at 20:27)</a>:</h4>
<p>I think the canonicalize could be removed if we did it during argument parsing or session construction or somewhere similar.</p>



<a name="224097992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224097992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224097992">(Jan 26 2021 at 20:27)</a>:</h4>
<p>I don't believe these arguments need to remain non-canon anywhere, really.</p>



<a name="224098082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224098082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224098082">(Jan 26 2021 at 20:28)</a>:</h4>
<p>We could also consider some cache here too.</p>



<a name="224098989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224098989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224098989">(Jan 26 2021 at 20:35)</a>:</h4>
<p>I'm working on a change where we canoncalize earlier.</p>



<a name="224103041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224103041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224103041">(Jan 26 2021 at 21:05)</a>:</h4>
<p>Canoncalizing early made that particular code path from 4.56% of compilation to 0.03% of compilation. 11.3 seconds to 75 milliseconds. <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="224103164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224103164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224103164">(Jan 26 2021 at 21:06)</a>:</h4>
<p><span aria-label="crab" class="emoji emoji-1f980" role="img" title="crab">:crab:</span></p>



<a name="224103859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224103859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224103859">(Jan 26 2021 at 21:12)</a>:</h4>
<p>My test is building in 223 seconds an improvement over the 292 seconds it took at the start of the day.</p>



<a name="224105156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224105156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224105156">(Jan 26 2021 at 21:20)</a>:</h4>
<p>at this rate we'll be faster than Jai by the end of the week.</p>



<a name="224106551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/224106551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#224106551">(Jan 26 2021 at 21:31)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/81419">https://github.com/rust-lang/rust/pull/81419</a></p>



<a name="225031655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225031655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225031655">(Feb 03 2021 at 15:31)</a>:</h4>
<p>So I'm doing some more perf runs on windows-rs, and I thought I'd take a break to write what I've found so far. So the current state of the world can be seen <a href="https://gist.github.com/rylev/c001fafe2010ee401b767f684e3fca2a">here</a>. This biggest chunk of time is currently <code>specialization_graph_of</code>. </p>
<p>So I added some tracing in there, and it led me to 99% of that time being taken in <code>traits::overlapping_impls</code> or concretely in <a href="https://github.com/rust-lang/rust/blob/6ad11e2e25919b75ebbc36d7910f2a1126a7e873/compiler/rustc_trait_selection/src/traits/coherence.rs#L127"><code>overlap_within_probe</code></a> which you can find in "rustc_trait_selection/src/traits/coherence.rs". Essentially this code is checking whether certain types implement certain traits. </p>
<p>A large chunk of the time is being spent in <a href="https://github.com/rust-lang/rust/blob/6ad11e2e25919b75ebbc36d7910f2a1126a7e873/compiler/rustc_trait_selection/src/traits/coherence.rs#L150"><code>eq_impl_headers</code></a> which is being called 28127243 times (the same number of times as <code>overlap_within_probe</code>. The implementation seems simple but it's currently taking 2.6% of total compilation time. </p>
<p>My next step is to figure out why that particular call is taking so long, and then work on more areas of <code>overlap_within_probe</code>.</p>



<a name="225041849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225041849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225041849">(Feb 03 2021 at 16:37)</a>:</h4>
<p>did you try with jonas' quick-early-out PR (if it hasn't landed since then and removed that pain point) for the cases where there's actually no overlap ? I found it helped a lot when we initially were talking about this: this was IIRC all/most of the cases for that crate (my recollection was that it was slightly slower on all but the biggest specialization graphs and that was why it hadn't initially landed; please ignore if this has since been fixed <span aria-label="pray" class="emoji emoji-1f64f" role="img" title="pray">:pray:</span>)</p>



<a name="225132917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225132917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225132917">(Feb 04 2021 at 08:53)</a>:</h4>
<p>No, I hadn't but that's a very good point. Let me do that</p>



<a name="225133214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225133214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225133214">(Feb 04 2021 at 08:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> do you still have a link to those changes? I can't find them</p>



<a name="225133974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225133974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225133974">(Feb 04 2021 at 09:04)</a>:</h4>
<p>Found it: <a href="https://github.com/jonas-schievink/rust/commit/d0bbdc3c3253e30f531bf75102a1f64a38a59e49">https://github.com/jonas-schievink/rust/commit/d0bbdc3c3253e30f531bf75102a1f64a38a59e49</a></p>



<a name="225135171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225135171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225135171">(Feb 04 2021 at 09:17)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> Do you remember why this code was never merged? I don't believe a PR was even opened.</p>



<a name="225136962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225136962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225136962">(Feb 04 2021 at 09:35)</a>:</h4>
<p>This certainly helps the windows crate! This reduces compilation from 500s to 380s which is pretty huge.</p>



<a name="225137176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225137176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225137176">(Feb 04 2021 at 09:37)</a>:</h4>
<p>Specialization still takes 20s, but it took 137s before.</p>



<a name="225137367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225137367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225137367">(Feb 04 2021 at 09:39)</a>:</h4>
<p>Found <span class="user-mention" data-user-id="211727">@Jonas Schievink</span>'s original PR for this: <a href="https://github.com/rust-lang/rust/pull/69010">https://github.com/rust-lang/rust/pull/69010</a></p>



<a name="225137385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225137385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225137385">(Feb 04 2021 at 09:39)</a>:</h4>
<p>I'm going to reopen a PR so we can discuss there.</p>



<a name="225139153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225139153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225139153">(Feb 04 2021 at 09:57)</a>:</h4>
<p>New PR: <a href="https://github.com/rust-lang/rust/pull/81744">https://github.com/rust-lang/rust/pull/81744</a></p>



<a name="225149976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225149976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225149976">(Feb 04 2021 at 12:01)</a>:</h4>
<p>sorry I was at work, glad you found it in the meantime</p>



<a name="225150587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225150587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225150587">(Feb 04 2021 at 12:08)</a>:</h4>
<p>our original investigation was in <a href="#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/stress-test/near/205068743">https://rust-lang.zulipchat.com/#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/stress-test/near/205068743</a> and this fast reject had a pretty dramatic impact in my tests</p>



<a name="225152023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225152023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225152023">(Feb 04 2021 at 12:25)</a>:</h4>
<p>it would be great if coherence could be improved to make that PR unneeded (nor cause possible slowdowns for smaller crates) but in the meantime it's very effective for cases like windows-rs (which are seemingly not yet tracked in rustc-perf benchmarks)</p>



<a name="225153042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225153042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225153042">(Feb 04 2021 at 12:36)</a>:</h4>
<p>given the huge gains, the small hit looks acceptable to me of course ^^</p>



<a name="225153872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225153872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225153872">(Feb 04 2021 at 12:44)</a>:</h4>
<p>I'm unsure how represenative packed-simd is.</p>



<a name="225154632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225154632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225154632">(Feb 04 2021 at 12:52)</a>:</h4>
<p>I'm not sure either (and it's kind of unfortunate we don't yet have more and deeper stats about the structure of the benchmarked code to answer such questions)</p>



<a name="225154689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225154689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225154689">(Feb 04 2021 at 12:52)</a>:</h4>
<p>I'm confused as to why packed-simd slows down at all, I would've expected it to <em>improve</em></p>



<a name="225154761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225154761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225154761">(Feb 04 2021 at 12:53)</a>:</h4>
<p>Yes, I'm also confused. I'm going to compile it locally with some additional perf items added to my local compiler</p>



<a name="225154937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225154937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225154937">(Feb 04 2021 at 12:55)</a>:</h4>
<p>we may need to see its specialization graph to know why / whether many types may actually unify ?</p>



<a name="225155950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225155950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225155950">(Feb 04 2021 at 13:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> would you be interested in seeing a windows-rs benchmark added given your comments <a href="https://github.com/rust-lang/rust/pull/81744#issuecomment-773284576">here</a>?</p>



<a name="225156254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225156254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225156254">(Feb 04 2021 at 13:07)</a>:</h4>
<p>Interestingly, the packed-simd crate takes much longer for me (on Windows) than it seems to take the perf collector (on Linux). I wonder if this is just differences in machines or if the platform has something to do with it.</p>



<a name="225156729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225156729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225156729">(Feb 04 2021 at 13:12)</a>:</h4>
<p>In theory, yes, but we're quite limited in terms of available time on the machine right now - so we might not be able to afford it. I hope to be able to invest some time in letting perf scale more effectively to multiple machines so that we can more readily accept benchmarks (also tomorrow's discussion may help in identifying which ones are most important).</p>



<a name="225156959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225156959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225156959">(Feb 04 2021 at 13:14)</a>:</h4>
<p>We'd actually also need windows support to add a bench as windows-rs does not build (in any meaningful way) on Linux</p>



<a name="225158195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225158195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225158195">(Feb 04 2021 at 13:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I did some local benchmarking and it seems that in the packed-simd case the optimization only catches 13% of the overlapping calls. So we're paying the price on every call only for 13% of the calls to be helped by it.</p>



<a name="225158752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225158752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225158752">(Feb 04 2021 at 13:29)</a>:</h4>
<p>That figure is around 99% in the windows-rs case</p>



<a name="225159046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225159046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225159046">(Feb 04 2021 at 13:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/225156959">said</a>:</p>
<blockquote>
<p>We'd actually also need windows support to add a bench as windows-rs does not build (in any meaningful way) on Linux</p>
</blockquote>
<p>Yeah multi-server support would likely help with this. though I imagine in this particular case a cargo check should work? that doesn't even link...</p>



<a name="225159225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225159225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225159225">(Feb 04 2021 at 13:33)</a>:</h4>
<p>I've not tried, but you're probably right that cargo check works (though I do think there's still one trivial bug that needs to be fixed for it to actually work)</p>



<a name="225169564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225169564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225169564">(Feb 04 2021 at 14:56)</a>:</h4>
<p>cargo check does not work, the build script tries to link to the windows runtime</p>



<a name="225169643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225169643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225169643">(Feb 04 2021 at 14:57)</a>:</h4>
<p>If it worked I wouldn't have to keep asking <span class="user-mention silent" data-user-id="224872">rylev</span> for help measuring the doc runs :P</p>



<a name="225169743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225169743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225169743">(Feb 04 2021 at 14:58)</a>:</h4>
<p>Ah I thought it was just the path bug (there's an issue where we encode a path using windows path separators which breaks on other platforms)</p>



<a name="225170373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225170373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225170373">(Feb 04 2021 at 15:02)</a>:</h4>
<p>Does it build with <code>windows-gnu</code> target? It'd be fairly easy to cross compile from Linux to Windows with mingw-w64.<br>
Otherwise <code>stm32h7</code> crate which suffers from similar issue could be used.</p>



<a name="225170813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225170813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225170813">(Feb 04 2021 at 15:04)</a>:</h4>
<p>I've not tried with <code>windows-gnu</code>. We might be relying on some linker defaults that aren't present in <code>windows-gnu</code>.</p>



<a name="225171107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225171107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225171107">(Feb 04 2021 at 15:06)</a>:</h4>
<p><span class="user-mention" data-user-id="119581">@mati865</span> I've had a PR open for stm for ages, <span class="user-mention silent" data-user-id="116122">simulacrum</span> was worried it still takes too much time :/</p>



<a name="225171735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225171735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225171735">(Feb 04 2021 at 15:10)</a>:</h4>
<p>So <code>windows-rs</code> crate would have the same issue. Maybe it'd be possible to extract part of <code>stm32h7</code> that finishes in reasonable time and still reproduces the issue?</p>



<a name="225172878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225172878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225172878">(Feb 04 2021 at 15:17)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> FWIW <code>cargo doc --target x86_64-pc-windows-gnu</code> finishes without errors but it documented only <code>windows_gen</code>, <code>windows_gen_macros</code>, <code>windows_macros</code>, <code>windows_winmd</code>, <code>windows_winmd_macros</code> and their dependencies.</p>



<a name="225173236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225173236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225173236">(Feb 04 2021 at 15:19)</a>:</h4>
<p>Strange that the main crate didn't document..</p>



<a name="225175066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225175066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225175066">(Feb 04 2021 at 15:32)</a>:</h4>
<p>Hmm, generated <code>windows.rs</code> has 50k lines so I'd guess it's fine. Maybe rustdoc doesn't like cross compilation?</p>



<a name="225175368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225175368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225175368">(Feb 04 2021 at 15:34)</a>:</h4>
<p>No, <code>windows-rs</code> running natively on <code>windows-gnu</code> gave the same results. So it must be something inside <code>windows-rs</code>.</p>



<a name="225189813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225189813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225189813">(Feb 04 2021 at 17:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/225158195">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> I did some local benchmarking and it seems that in the packed-simd case the optimization only catches 13% of the overlapping calls. So we're paying the price on every call only for 13% of the calls to be helped by it.</p>
</blockquote>
<p>Thanks for the measurements <span aria-label="thank you" class="emoji emoji-1f64f" role="img" title="thank you">:thank_you:</span> this makes sense to me as well, as you said, for these kinds of numbers. Until/if one can redesign this coherence check, it'll only add cost to try to avoid the most expensive part of the coherence check. Maybe that additional fast reject could be even less costly for <code>packed-simd</code>, but I myself am not too worried about this yet without actual data showing that this case is actually representative in the wild (not that my opinion matters much). Last time I looked at this, it seemed like the type simplification was indeed quite fast but I hadn't measured in the aggregate, over the whole coherence check, whether there was e.g. duplicated work here (say, if we're simplifying the same types over and over and that this started to become noticeable) to still reduce the fast reject cost.</p>



<a name="225190723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225190723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225190723">(Feb 04 2021 at 17:09)</a>:</h4>
<p>Yea the issue is that this code gets called _a lot_ so even if it's pretty fast to call it once, small changes in the perf characteristics can make big differences in the aggregate.</p>



<a name="225196737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225196737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225196737">(Feb 04 2021 at 17:54)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> What's the latest on the rustdoc performance issue?</p>



<a name="225196790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225196790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225196790">(Feb 04 2021 at 17:55)</a>:</h4>
<p>You mean get_blanket_impls? Or windows-docs-rs in general?</p>



<a name="225196929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225196929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225196929">(Feb 04 2021 at 17:56)</a>:</h4>
<p>I don't have a way to measure performance for windows-docs-rs because it doesn't compile on Linux</p>



<a name="225196984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225196984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225196984">(Feb 04 2021 at 17:56)</a>:</h4>
<p>Err well someone sent me the generated source a while back, I don't think I've tried to compile it yet</p>



<a name="225197008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225197008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225197008">(Feb 04 2021 at 17:56)</a>:</h4>
<p>In general. Sorry I should have looked again at the conversations. I thought that you had figured out why memory was ballooning</p>



<a name="225197061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225197061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225197061">(Feb 04 2021 at 17:57)</a>:</h4>
<p>Oh well there's a lot of reasons</p>



<a name="225197096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225197096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225197096">(Feb 04 2021 at 17:57)</a>:</h4>
<p>Just generating the ast is like 7 GB</p>



<a name="225197337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225197337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225197337">(Feb 04 2021 at 17:59)</a>:</h4>
<p>Ok I can look into this next</p>



<a name="225197464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225197464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225197464">(Feb 04 2021 at 17:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/225190723">said</a>:</p>
<blockquote>
<p>Yea the issue is that this code gets called _a lot_ so even if it's pretty fast to call it once, small changes in the perf characteristics can make big differences in the aggregate.</p>
</blockquote>
<p>(maybe one can remeasure <code>fast_reject::simplify_type</code> over the whole crate, or see whether the fast reject check is doing duplicated work over all types -- probably not worth it for just <code>packed-simd</code>and we instead eat the &lt;1% hit)</p>



<a name="225202405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225202405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225202405">(Feb 04 2021 at 18:34)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> here are the perf measurements: <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223964891">https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223964891</a></p>



<a name="225202627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/225202627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#225202627">(Feb 04 2021 at 18:35)</a>:</h4>
<p>it would also be super helpful to measure memory usage with self-profile: <a href="https://github.com/rust-lang/rust/issues/81348">https://github.com/rust-lang/rust/issues/81348</a></p>



<a name="226361423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226361423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226361423">(Feb 15 2021 at 09:34)</a>:</h4>
<p>So with the 3rd change meant to help windows-rs perf (<a href="https://github.com/rust-lang/rust/pull/81744">#81744</a> -  simplifying types for fast coherence checking) merged, full builds are showing really good improvement over 1.50. On the full build of all windows metadata (representing the entire Windows API surface), builds go from ~39min on stable to ~18min30s on nightly, an improvement of roughly 53% <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span>On a more real world use case, <a href="https://github.com/robmikh/minesweeper-rs">minesweeper-rs</a>, the crate compiles in ~44s on stable and ~34s on nightly a roughly 23% improvement. Most of the gain is already on beta which compiles in ~35s.</p>



<a name="226362832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226362832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226362832">(Feb 15 2021 at 09:48)</a>:</h4>
<p>Here's the latest state of perf data:</p>
<div class="codehilite"><pre><span></span><code>+--------------------------------------------------+-----------+-----------------+----------+------------+
| Item                                             | Self time | % of total time | Time     | Item count |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| LLVM_module_codegen_emit_obj                     | 13.58s    | 19.710          | 13.58s   | 151        |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| typeck                                           | 8.57s     | 12.443          | 8.92s    | 53429      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| mir_borrowck                                     | 5.14s     | 7.463           | 9.59s    | 53429      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| LLVM_passes                                      | 4.36s     | 6.326           | 4.36s    | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| codegen_module                                   | 4.05s     | 5.884           | 4.65s    | 151        |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| mir_built                                        | 2.16s     | 3.132           | 2.49s    | 53429      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| optimized_mir                                    | 1.96s     | 2.850           | 4.05s    | 48984      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| expand_crate                                     | 1.88s     | 2.722           | 1.88s    | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| mir_drops_elaborated_and_const_checked           | 1.49s     | 2.167           | 1.59s    | 53429      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| check_item_well_formed                           | 1.38s     | 1.999           | 2.48s    | 51415      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| evaluate_obligation                              | 1.21s     | 1.757           | 1.22s    | 94039      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| check_impl_item_well_formed                      | 1.05s     | 1.528           | 1.65s    | 55461      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| codegen_fulfill_obligation                       | 925.94ms  | 1.344           | 953.17ms | 20536      |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| hir_lowering                                     | 900.64ms  | 1.307           | 900.64ms | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| incr_comp_encode_serialized_dep_graph            | 709.61ms  | 1.030           | 709.61ms | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| link_rlib                                        | 685.19ms  | 0.994           | 685.19ms | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| generate_crate_metadata                          | 681.29ms  | 0.989           | 7.32s    | 1          |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| specialization_graph_of                          | 667.50ms  | 0.969           | 719.10ms | 20         |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| check_mod_privacy                                | 666.44ms  | 0.967           | 684.08ms | 78         |
+--------------------------------------------------+-----------+-----------------+----------+------------+
| encode_query_results_for                         | 634.50ms  | 0.921           | 634.50ms | 24         |
</code></pre></div>



<a name="226363111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226363111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226363111">(Feb 15 2021 at 09:51)</a>:</h4>
<p>Besides codegen, it looks like type checking and borrow checking are the biggest culprits. Thought it's interesting to see <code>generate_crate_metadata</code> having a time of 7.32 seconds.</p>



<a name="226363253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226363253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226363253">(Feb 15 2021 at 09:53)</a>:</h4>
<p><code>generate_crate_metadata</code> invokes several queries for the first time that will also be invoked during codegen.</p>



<a name="226374235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226374235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226374235">(Feb 15 2021 at 11:50)</a>:</h4>
<p>So checking that items are well formed is fairly expensive, and the code requires we do it often. I'm not sure this is a place we can easily win performance though.</p>



<a name="226950539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226950539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226950539">(Feb 19 2021 at 11:25)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> good news. Documenting the <code>windows</code> crate is <em>much</em> faster now than it was in the past. I can fully document the entire Windows API surface in ~11 minutes. This was around 40 something minutes before. <a href="https://gist.github.com/rylev/700deb0576f655b6f019d05a03fb5099">Here are the timings when running with <code>-Zself-profile</code></a>. Looks like a vast majority of the time is inside of <code>render_item</code>.</p>



<a name="226952225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226952225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226952225">(Feb 19 2021 at 11:43)</a>:</h4>
<p>I've also added the -Ztime-passes output</p>



<a name="226954119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226954119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226954119">(Feb 19 2021 at 12:04)</a>:</h4>
<p>11 minutes spent writing html, wow.</p>



<a name="226954133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226954133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226954133">(Feb 19 2021 at 12:04)</a>:</h4>
<p>that sounds like a lot of html.</p>



<a name="226954643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226954643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226954643">(Feb 19 2021 at 12:10)</a>:</h4>
<p>It’s a few gigabytes.</p>



<a name="226956832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226956832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226956832">(Feb 19 2021 at 12:32)</a>:</h4>
<p>3.7GB to be more precise</p>



<a name="226956917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226956917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226956917">(Feb 19 2021 at 12:33)</a>:</h4>
<blockquote>
<div class="codehilite"><pre><span></span><code>Finished dev [unoptimized + debuginfo] target(s) in 9m 55s
</code></pre></div>

<p>Total cpu time: 604.8735123s</p>
</blockquote>
<p>Seems to be entirely single-threaded.</p>



<a name="226957210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226957210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226957210">(Feb 19 2021 at 12:36)</a>:</h4>
<p>Yep 595s actual time vs 605s cpu time</p>



<a name="226957262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226957262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226957262">(Feb 19 2021 at 12:37)</a>:</h4>
<p>I'd like to see if we can parallelize the main loop of rustdoc: <a href="https://github.com/rust-lang/rust/blob/a73c2e555c26ef0c8b98c91c97a7d24b7017267f/src/librustdoc/formats/renderer.rs#L84-L109">https://github.com/rust-lang/rust/blob/a73c2e555c26ef0c8b98c91c97a7d24b7017267f/src/librustdoc/formats/renderer.rs#L84-L109</a></p>



<a name="226957401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226957401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226957401">(Feb 19 2021 at 12:38)</a>:</h4>
<p>/me does a very quick-n-dirty check</p>



<a name="226957858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226957858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226957858">(Feb 19 2021 at 12:43)</a>:</h4>
<p>Looking at the code likely the most troublesome thing there is how the main loop discovers new things to render as it renders other things.</p>



<a name="226957869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226957869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226957869">(Feb 19 2021 at 12:43)</a>:</h4>
<p>rather than figuring this ahead-of-time.</p>



<a name="226958008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958008">(Feb 19 2021 at 12:45)</a>:</h4>
<p>As a very straightforward change you could probably hack something together with MPMC channels?</p>



<a name="226958143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958143">(Feb 19 2021 at 12:46)</a>:</h4>
<p>Yea I think I'll try that</p>



<a name="226958465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958465">(Feb 19 2021 at 12:48)</a>:</h4>
<p>Just need to figure out the best way to not spawn thousands of threads.</p>



<a name="226958512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958512">(Feb 19 2021 at 12:49)</a>:</h4>
<p>there's a rayon::spawn, and librustdoc already depends on rayon.</p>



<a name="226958543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958543">(Feb 19 2021 at 12:49)</a>:</h4>
<p>Ah great!</p>



<a name="226958595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226958595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226958595">(Feb 19 2021 at 12:50)</a>:</h4>
<p>and it uses mpmc under the hood, so you can just have tasks spawning more tasks</p>



<a name="226965885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226965885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226965885">(Feb 19 2021 at 13:57)</a>:</h4>
<p>Wow, I'm surprised collect_trait_impls takes so little time. I could have sworn it was taking something ridiculous like 30 minutes before. Is that something you fixed?</p>



<a name="226965976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226965976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226965976">(Feb 19 2021 at 13:58)</a>:</h4>
<p>And yes parallelizing render sounds feasible</p>



<a name="226966420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226966420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226966420">(Feb 19 2021 at 14:01)</a>:</h4>
<p>I also expect <code>fn item</code> to be super inefficient, that might be worth looking into</p>



<a name="226967020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967020">(Feb 19 2021 at 14:06)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I believe <a href="https://github.com/rust-lang/rust/pull/81744">https://github.com/rust-lang/rust/pull/81744</a> would have a big positive impact on <code>collect_trait_impls</code></p>



<a name="226967087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967087">(Feb 19 2021 at 14:06)</a>:</h4>
<p>Unfortunately paralellizing the render won't be super easy as a lot of things aren't <code>Send</code> currently.</p>



<a name="226967634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967634">(Feb 19 2021 at 14:11)</a>:</h4>
<p>I expect <a href="https://github.com/rust-lang/rust/pull/82020">https://github.com/rust-lang/rust/pull/82020</a> to help with that</p>



<a name="226967658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967658">(Feb 19 2021 at 14:11)</a>:</h4>
<p>it's mostly Rcs and RefCells, right?</p>



<a name="226967810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967810">(Feb 19 2021 at 14:12)</a>:</h4>
<p>Yea mostly but also Spans</p>



<a name="226967825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967825">(Feb 19 2021 at 14:12)</a>:</h4>
<p>You'll need <code>cfg(parallel_compiler)</code>.</p>



<a name="226967856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967856">(Feb 19 2021 at 14:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226967810">said</a>:</p>
<blockquote>
<p>Yea mostly but also Spans</p>
</blockquote>
<p>oh hmm, you mean <code>clean::Span</code>?</p>



<a name="226967873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967873">(Feb 19 2021 at 14:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226967825">said</a>:</p>
<blockquote>
<p>You'll need <code>cfg(parallel_compiler)</code>.</p>
</blockquote>
<p>that won't help with rustdoc</p>



<a name="226967928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226967928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226967928">(Feb 19 2021 at 14:13)</a>:</h4>
<p>You need <code>parallel_compiler</code> for spans to become send.</p>



<a name="226968025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968025">(Feb 19 2021 at 14:14)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_span/lib.rs.html#323">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_span/lib.rs.html#323</a></p>



<a name="226968113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968113">(Feb 19 2021 at 14:14)</a>:</h4>
<p>I should likely note that there are (iirc) bugs with the handling of parallelism with that turned on, in particular -j1 doesn't actually work, so we'll want to be cautious about enabling it for rustdoc (and we can't really do so in production without enabling it for the compiler itself too).</p>



<a name="226968315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968315">(Feb 19 2021 at 14:16)</a>:</h4>
<blockquote>
<p>there are (iirc) bugs with the handling of parallelism with that turned on</p>
</blockquote>
<p>do you mean <a href="https://github.com/rust-lang/rust/issues/75760">https://github.com/rust-lang/rust/issues/75760</a>? That's just different ordering for diagnostics I think, it should be fine for rustdoc</p>



<a name="226968370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968370">(Feb 19 2021 at 14:16)</a>:</h4>
<p>but yeah enabling for anything other than testing would be hard</p>



<a name="226968557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968557">(Feb 19 2021 at 14:18)</a>:</h4>
<p>No. That's not what I mean; I don't have an issue reference on hand, but I don't think we fixed the problems during the last work on the parallel compiler - we still had bugs around the jobserver token handling. (I am a bit confused why you point at that issue given that I specifically call out -j1 handling).</p>



<a name="226968824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968824">(Feb 19 2021 at 14:20)</a>:</h4>
<p>I thought -j1 was the default unless you pass -Z threads=n?</p>



<a name="226968957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226968957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226968957">(Feb 19 2021 at 14:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226966420">said</a>:</p>
<blockquote>
<p>I also expect <code>fn item</code> to be super inefficient, that might be worth looking into</p>
</blockquote>
<p>it would be useful to add timings around <a href="https://github.com/rust-lang/rust/blob/a73c2e555c26ef0c8b98c91c97a7d24b7017267f/src/librustdoc/html/render/mod.rs#L663">https://github.com/rust-lang/rust/blob/a73c2e555c26ef0c8b98c91c97a7d24b7017267f/src/librustdoc/html/render/mod.rs#L663</a></p>



<a name="226969185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969185">(Feb 19 2021 at 14:22)</a>:</h4>
<p>I don't think I can succinctly explain it beyond what I've already said. When parallel_compiler cfg is enabled, the jobserver integration currently does not work as it should in all cases; I consider this a blocker for turning it on in "prod". Fixing it is relatively non-trivial.</p>



<a name="226969667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969667">(Feb 19 2021 at 14:26)</a>:</h4>
<p>Would it be possible to create a type that represents the information we need from span and which is Send? We could then translate to that type before moving to another thread</p>



<a name="226969844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969844">(Feb 19 2021 at 14:27)</a>:</h4>
<p>I think the info needed is "all of <code>Span</code>" unfortunately</p>



<a name="226969898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969898">(Feb 19 2021 at 14:27)</a>:</h4>
<p>you can look where the <code>rustdoc</code> spans are used, I specifically went from that other type to the new one because it used a ton more memory</p>



<a name="226969901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969901">(Feb 19 2021 at 14:27)</a>:</h4>
<p>one sec</p>



<a name="226969960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226969960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226969960">(Feb 19 2021 at 14:27)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/79957#issuecomment-743912491">https://github.com/rust-lang/rust/pull/79957#issuecomment-743912491</a></p>



<a name="226970134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970134">(Feb 19 2021 at 14:28)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> do you think <a href="https://github.com/rust-lang/rust/pull/80339">https://github.com/rust-lang/rust/pull/80339</a> would help?</p>



<a name="226970291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970291">(Feb 19 2021 at 14:29)</a>:</h4>
<p>Looks like it should. Unfortunately I believe <code>Item::attributes</code> also have spans embedded in them</p>



<a name="226970399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970399">(Feb 19 2021 at 14:30)</a>:</h4>
<p>it would be nice to calculate those on demand too</p>



<a name="226970428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970428">(Feb 19 2021 at 14:30)</a>:</h4>
<p>none of this seems insurmountable, it just needs a lot of work <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="226970499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970499">(Feb 19 2021 at 14:31)</a>:</h4>
<p>I can help work on it if we break it up into smaller pieces</p>



<a name="226970543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970543">(Feb 19 2021 at 14:31)</a>:</h4>
<p>I guess getting <a href="https://github.com/rust-lang/rust/pull/80339">https://github.com/rust-lang/rust/pull/80339</a> merged is a good first step</p>



<a name="226970578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970578">(Feb 19 2021 at 14:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226970543">said</a>:</p>
<blockquote>
<p>I guess getting <a href="https://github.com/rust-lang/rust/pull/80339">https://github.com/rust-lang/rust/pull/80339</a> merged is a good first step</p>
</blockquote>
<p>unfortunately it has regressions and I haven't figured out why</p>



<a name="226970596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970596">(Feb 19 2021 at 14:31)</a>:</h4>
<p>something to do with inner vs outer spans</p>



<a name="226970715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226970715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226970715">(Feb 19 2021 at 14:32)</a>:</h4>
<p><a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Get.20inner.20span.2C.20not.20outer.20span">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Get.20inner.20span.2C.20not.20outer.20span</a></p>



<a name="226971042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971042">(Feb 19 2021 at 14:34)</a>:</h4>
<p>That's unfortunate...</p>



<a name="226971172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971172">(Feb 19 2021 at 14:35)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> may have taken a crack at attributes at some point, let me try to find it</p>



<a name="226971290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971290">(Feb 19 2021 at 14:36)</a>:</h4>
<p>hmm, maybe not</p>



<a name="226971361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971361">(Feb 19 2021 at 14:36)</a>:</h4>
<p>let me ask a larger question: why are <code>Spans</code> not <code>Send</code> but <code>TyCtxt</code> is?</p>



<a name="226971392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971392">(Feb 19 2021 at 14:36)</a>:</h4>
<p>we'll need a TyCtxt anyway to recompute them where they're needed</p>



<a name="226971499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971499">(Feb 19 2021 at 14:37)</a>:</h4>
<p>Is <code>TyCtxt</code> <code>Send</code>? That might be a bigger issue</p>



<a name="226971506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971506">(Feb 19 2021 at 14:37)</a>:</h4>
<p>Oh I did, but never opened the PR because I'm not convinced by the current result</p>



<a name="226971973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226971973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226971973">(Feb 19 2021 at 14:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226971499">said</a>:</p>
<blockquote>
<p>Is <code>TyCtxt</code> <code>Send</code>? That might be a bigger issue</p>
</blockquote>
<p>Without <code>cfg(parallel_compiler)</code> probably not</p>



<a name="226972055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972055">(Feb 19 2021 at 14:41)</a>:</h4>
<p>yup: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#impl-Send">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#impl-Send</a></p>



<a name="226972238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972238">(Feb 19 2021 at 14:43)</a>:</h4>
<p>what you <em>could</em> do though is to move all the IO into worker threads</p>



<a name="226972263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972263">(Feb 19 2021 at 14:43)</a>:</h4>
<p>and keep working on the single-threaded stuff while the IO runs in the background</p>



<a name="226972293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972293">(Feb 19 2021 at 14:43)</a>:</h4>
<p>yes maybe it's a good idea to see how long the I/O is taking vs the actual rendering</p>



<a name="226972604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972604">(Feb 19 2021 at 14:45)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> should we open an issue about the performance of rendering?  It'd be nice to capture some of this in an issue</p>



<a name="226972629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972629">(Feb 19 2021 at 14:46)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> go for it :)</p>



<a name="226972675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226972675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226972675">(Feb 19 2021 at 14:46)</a>:</h4>
<p>I will be busy this morning fixing <a href="https://github.com/rust-lang/rust/issues/82284">https://github.com/rust-lang/rust/issues/82284</a></p>



<a name="226973002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973002">(Feb 19 2021 at 14:48)</a>:</h4>
<p>Hmm looks like we're already writing file contents on another thread on Windows...</p>



<a name="226973034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973034">(Feb 19 2021 at 14:49)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/docfs.rs#L64-L77">https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/docfs.rs#L64-L77</a></p>



<a name="226973109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973109">(Feb 19 2021 at 14:49)</a>:</h4>
<p>maybe <code>sync_only</code> gets set somewhere?</p>



<a name="226973301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973301">(Feb 19 2021 at 14:51)</a>:</h4>
<p>I believe it only gets set in init</p>



<a name="226973417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973417">(Feb 19 2021 at 14:52)</a>:</h4>
<p>yeah that looks right</p>



<a name="226973505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226973505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226973505">(Feb 19 2021 at 14:52)</a>:</h4>
<p>I still think the first step is to see what actually takes so long</p>



<a name="226977787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226977787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226977787">(Feb 19 2021 at 15:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/82294">https://github.com/rust-lang/rust/issues/82294</a></p>



<a name="226980075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226980075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226980075">(Feb 19 2021 at 15:36)</a>:</h4>
<p>If you want to use <code>-Zself-profiler</code>, the easiest thing might be to drop a few calls to <code>tcx.sess.prof.generic_activity()</code> around bits of code to get timing data (<a href="https://github.com/rust-lang/rust/blob/8fe989dd768f5dfdb0fc90933f3f74fa4579fefd/src/librustdoc/passes/collect_trait_impls.rs#L42">example</a>).</p>



<a name="226981196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226981196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226981196">(Feb 19 2021 at 15:42)</a>:</h4>
<p>Yep, that's what I'm working on now <span aria-label="blush" class="emoji emoji-1f60a" role="img" title="blush">:blush:</span></p>



<a name="226987322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226987322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226987322">(Feb 19 2021 at 16:18)</a>:</h4>
<p>It's mostly the Rcs and RefCells, right?</p>



<a name="226987323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226987323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226987323">(Feb 19 2021 at 16:18)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/82020">https://github.com/rust-lang/rust/pull/82020</a> should help with that</p>



<a name="226990558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226990558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226990558">(Feb 19 2021 at 16:37)</a>:</h4>
<p>So two places that are taking a bunch of time: <a href="https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/render/mod.rs#L692-L697"><code>html::render::write_shared</code></a> and <a href="https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/layout.rs#L37"><code>html::layout::render</code></a></p>



<a name="226990679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226990679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226990679">(Feb 19 2021 at 16:38)</a>:</h4>
<p>The latter is interested because it's just creating strings so just doing heap allocation (and creating temporary collections to hold strings)</p>



<a name="226991345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991345">(Feb 19 2021 at 16:42)</a>:</h4>
<p>I did notice that rustdoc allocates about 5x as much memory as it has peak RSS</p>



<a name="226991372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991372">(Feb 19 2021 at 16:42)</a>:</h4>
<p>which seems to imply a lot of temporary allocations</p>



<a name="226991499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991499">(Feb 19 2021 at 16:43)</a>:</h4>
<p>actually <span class="user-mention" data-user-id="224872">@rylev</span> this explains why the IO isn't parallel: write_shared is called while the single-threaded lock is active</p>



<a name="226991500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991500">(Feb 19 2021 at 16:43)</a>:</h4>
<p>The code might be uglier, but I wonder if using <code>write!</code> instead of <code>format!</code> could really help here.</p>



<a name="226991526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991526">(Feb 19 2021 at 16:43)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/render/mod.rs#L519">https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/render/mod.rs#L519</a></p>



<a name="226991592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991592">(Feb 19 2021 at 16:44)</a>:</h4>
<p>getting rid of that lock might be a good starting point :)</p>



<a name="226991617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991617">(Feb 19 2021 at 16:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226991499">said</a>:</p>
<blockquote>
<p>actually <span class="user-mention silent" data-user-id="224872">rylev</span> this explains why the IO isn't parallel: write_shared is called while the single-threaded lock is active</p>
</blockquote>
<p>Yep but this is just the start of rendering, there's other I/O that doesn't happen when that lock is active</p>



<a name="226991655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991655">(Feb 19 2021 at 16:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226991592">said</a>:</p>
<blockquote>
<p>getting rid of that lock might be a good starting point :)</p>
</blockquote>
<p>Yea but then I need to understand why it's there in the first place.</p>



<a name="226991698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991698">(Feb 19 2021 at 16:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226991655">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/226991592">said</a>:</p>
<blockquote>
<p>getting rid of that lock might be a good starting point :)</p>
</blockquote>
<p>Yea but then I need to understand why it's there in the first place.</p>
</blockquote>
<p>welcome to rustdoc <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="226991723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991723">(Feb 19 2021 at 16:45)</a>:</h4>
<p>It seems like this is preventing multiple instances of rustdoc running at the same time</p>



<a name="226991787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226991787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226991787">(Feb 19 2021 at 16:45)</a>:</h4>
<p>oh yeah running rustdoc in parallel leads to a bad time <a href="https://github.com/rust-lang/cargo/pull/4977#issuecomment-360312443">https://github.com/rust-lang/cargo/pull/4977#issuecomment-360312443</a></p>



<a name="226992018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226992018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226992018">(Feb 19 2021 at 16:47)</a>:</h4>
<p>err actually this was the issue I wanted <a href="https://github.com/rust-lang/rust/issues/30220">https://github.com/rust-lang/rust/issues/30220</a></p>



<a name="226992175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226992175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226992175">(Feb 19 2021 at 16:48)</a>:</h4>
<p>it sounds like speeding up <code>render</code> will be easier, so that seems like a good place to start</p>



<a name="226992181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226992181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226992181">(Feb 19 2021 at 16:48)</a>:</h4>
<p>I'm fine with using <code>write!</code></p>



<a name="226992931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226992931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226992931">(Feb 19 2021 at 16:54)</a>:</h4>
<p>Another possibility is to use a BufWriter directly so it doesn't have to be copied as much. Not sure if that would help much in practice though.</p>



<a name="226999588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226999588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226999588">(Feb 19 2021 at 17:39)</a>:</h4>
<p>You can also just <code>String::with_capacity</code>, if you dont wanna thread file handles in and out of functions and stick to returning strings</p>



<a name="226999648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/226999648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#226999648">(Feb 19 2021 at 17:39)</a>:</h4>
<p>(I'm not familiar with the code ignore me if that's already being done)</p>



<a name="227000877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227000877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227000877">(Feb 19 2021 at 17:48)</a>:</h4>
<p>I've changed the rendering code to use <code>write!</code> but I'm now getting a panic..."thread 'rustc' panicked at 'Deref section without derived id', src\librustdoc\html\render\mod.rs:4451:22"</p>



<a name="227000917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227000917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227000917">(Feb 19 2021 at 17:48)</a>:</h4>
<p>No idea why changing how we're generating a rendered strings would cause this. I'll push my code</p>



<a name="227001144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227001144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227001144">(Feb 19 2021 at 17:50)</a>:</h4>
<p>I must have changed a call to a helper function, but I don't see it</p>



<a name="227001169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227001169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227001169">(Feb 19 2021 at 17:50)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/compare/master...rylev:rustdoc-writeln">https://github.com/rust-lang/rust/compare/master...rylev:rustdoc-writeln</a></p>



<a name="227001724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227001724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227001724">(Feb 19 2021 at 17:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224872">rylev</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/227000877">said</a>:</p>
<blockquote>
<p>I've changed the rendering code to use <code>write!</code> but I'm now getting a panic..."thread 'rustc' panicked at 'Deref section without derived id', src\librustdoc\html\render\mod.rs:4451:22"</p>
</blockquote>
<p>that sounds like <a href="https://github.com/rust-lang/rust/issues/81395">https://github.com/rust-lang/rust/issues/81395</a></p>



<a name="227001967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227001967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227001967">(Feb 19 2021 at 17:55)</a>:</h4>
<p>Yea but it works fine without my changes</p>



<a name="227001993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227001993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227001993">(Feb 19 2021 at 17:55)</a>:</h4>
<p>right, yeah, just trying to get a feel for what could be going wrong</p>



<a name="227002213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002213">(Feb 19 2021 at 17:57)</a>:</h4>
<div class="codehilite"><pre><span></span><code>stack backtrace:
   0: std::panicking::begin_panic_handler
             at C:\Users\ryanl\Code\rust\library\std\src\panicking.rs:493
   1: core::panicking::panic_fmt
             at C:\Users\ryanl\Code\rust\library\core\src\panicking.rs:92
   2: core::option::expect_failed
             at C:\Users\ryanl\Code\rust\library\core\src\option.rs:1292
   3: core::option::Option::expect
             at C:\Users\ryanl\Code\rust\library\core\src\option.rs:349
   4: rustdoc::html::render::sidebar_deref_methods
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:4449
   5: rustdoc::html::render::sidebar_assoc_items
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:4333
   6: rustdoc::html::render::sidebar_struct
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:4503
   7: rustdoc::html::render::print_sidebar
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:4173
   8: rustdoc::html::render::{{impl}}::render_item::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:1583
   9: core::ops::function::FnOnce::call_once
             at C:\Users\ryanl\Code\rust\library\core\src\ops\function.rs:227
  10: rustdoc::html::format::{{impl}}::print
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\format.rs:34
  11: rustdoc::html::format::Buffer::to_display&lt;closure-1&gt;
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\format.rs:101
  12: rustdoc::html::layout::render&lt;closure-2,closure-1&gt;
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\layout.rs:197
  13: rustdoc::html::render::Context::render_item
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:1580
  14: rustdoc::html::render::{{impl}}::item
             at C:\Users\ryanl\Code\rust\src\librustdoc\html\render\mod.rs:662
  15: rustdoc::formats::renderer::run_format::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\formats\renderer.rs:71
  16: rustc_data_structures::profiling::TimingGuard::run
             at C:\Users\ryanl\Code\rust\compiler\rustc_data_structures\src\profiling.rs:552
  17: rustdoc::formats::renderer::run_format&lt;rustdoc::html::render::Context&gt;
             at C:\Users\ryanl\Code\rust\src\librustdoc\formats\renderer.rs:106
  18: rustdoc::run_renderer&lt;rustdoc::html::render::Context&gt;
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:488
  19: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:595
  20: rustc_data_structures::profiling::VerboseTimingGuard::run
             at C:\Users\ryanl\Code\rust\compiler\rustc_data_structures\src\profiling.rs:573
  21: rustc_session::session::Session::time&lt;core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;,closure-1&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_session\src\utils.rs:10
  22: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:584
  23: rustc_interface::passes::{{impl}}::enter::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\passes.rs:749
  24: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_middle\src\ty\context.rs:1714
  25: rustc_middle::ty::context::tls::set_tlv
             at C:\Users\ryanl\Code\rust\compiler\rustc_middle\src\ty\context.rs:1698
  26: rustc_middle::ty::context::tls::enter_context
             at C:\Users\ryanl\Code\rust\compiler\rustc_middle\src\ty\context.rs:1714
  27: rustc_interface::passes::QueryContext::enter&lt;closure-0,core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\passes.rs:749
  28: rustdoc::main_options::{{closure}}::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:556
  29: rustc_interface::interface::Compiler::enter&lt;closure-0,core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\queries.rs:418
  30: rustdoc::main_options::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:542
  31: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\interface.rs:197
  32: rustc_span::with_source_map&lt;core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;,closure-0&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_span\src\lib.rs:788
  33: rustc_interface::interface::create_compiler_and_run&lt;core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;,closure-0&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\interface.rs:191
  34: rustdoc::main_options
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:541
  35: rustdoc::main_args::{{closure}}
             at C:\Users\ryanl\Code\rust\src\librustdoc\lib.rs:466
  36: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\util.rs:152
  37: scoped_tls::ScopedKey::set&lt;rustc_span::SessionGlobals,closure-0,core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;&gt;
             at C:\Users\ryanl\.cargo\registry\src\github.com-1ecc6299db9ec823\scoped-tls-1.0.0\src\lib.rs:137
  38: rustc_span::with_session_globals&lt;core::result::Result&lt;tuple&lt;&gt;, rustc_errors::ErrorReported&gt;,closure-0&gt;
             at C:\Users\ryanl\Code\rust\compiler\rustc_span\src\lib.rs:105
  39: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\util.rs:150
  40: rustc_interface::util::scoped_thread::{{closure}}
             at C:\Users\ryanl\Code\rust\compiler\rustc_interface\src\util.rs:125
</code></pre></div>



<a name="227002238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002238">(Feb 19 2021 at 17:57)</a>:</h4>
<p>the bit with style files looks wrong: you now write<code>&lt;script id=default-settings&gt;</code> for each file, but before it was only written once</p>



<a name="227002316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002316">(Feb 19 2021 at 17:57)</a>:</h4>
<p>it should be writing <code>link rel=stylesheet</code> each time</p>



<a name="227002615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002615">(Feb 19 2021 at 17:59)</a>:</h4>
<p>Unsurprisingly that doesn't help, but I'll push the fix</p>



<a name="227002799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002799">(Feb 19 2021 at 18:00)</a>:</h4>
<p>The code in my changes that's in the backtrace from the panic is <code>sidebar = Buffer::html().to_display(sidebar)</code></p>



<a name="227002835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002835">(Feb 19 2021 at 18:01)</a>:</h4>
<p>I have to run unfortunately.</p>



<a name="227002916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002916">(Feb 19 2021 at 18:01)</a>:</h4>
<p>no problem</p>



<a name="227002952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002952">(Feb 19 2021 at 18:01)</a>:</h4>
<p>I expect something is modifying <code>Context</code> with interior mutability somewhere</p>



<a name="227002968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227002968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227002968">(Feb 19 2021 at 18:02)</a>:</h4>
<p>"somewhere" is unfortunately most of <code>render</code></p>



<a name="227003317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227003317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227003317">(Feb 19 2021 at 18:04)</a>:</h4>
<p>it looks like <code>deref_id_map</code> is only modified in <code>render_assoc_items</code></p>



<a name="227003369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227003369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227003369">(Feb 19 2021 at 18:04)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/render/mod.rs#L3515">https://github.com/rust-lang/rust/blob/8599bff5a3556059817503030e248507706e96b4/src/librustdoc/html/render/mod.rs#L3515</a></p>



<a name="227003483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227003483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227003483">(Feb 19 2021 at 18:05)</a>:</h4>
<p>which is called from ... lots of places, oof</p>



<a name="227003505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227003505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227003505">(Feb 19 2021 at 18:05)</a>:</h4>
<p>but yeah I suspect the order changed somehow</p>



<a name="227006276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227006276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227006276">(Feb 19 2021 at 18:27)</a>:</h4>
<p>I think it’s because the sidebar and content are now generated in a different order</p>



<a name="227006302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227006302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227006302">(Feb 19 2021 at 18:27)</a>:</h4>
<p>I’ll switch them when I’m back at a computer</p>



<a name="227028199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227028199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227028199">(Feb 19 2021 at 21:05)</a>:</h4>
<p>Looks like I was right. That fixed the panic. I’ll make a pull request once I have the time to measure the memory and performance impact.</p>



<a name="227272357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227272357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227272357">(Feb 22 2021 at 14:18)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> so I went down a rabbit hole of rustdoc performance and learned some things. Unfortunately the PR I have open is unlikely to help too much (though it might worth it to keep at least some of it to reduce pressure on the allocator). Unsurprisingly, a bunch chunk of rendering time is inside <a href="https://github.com/rust-lang/rust/blob/8a9f7862bcfa5870a34bb54f77a03c73d1db5c37/src/librustdoc/html/render/mod.rs#L1709"><code>print_item</code></a> specifically in <code>item_struct</code> and more specifically in <a href="https://github.com/rust-lang/rust/blob/8a9f7862bcfa5870a34bb54f77a03c73d1db5c37/src/librustdoc/html/render/mod.rs#L3490"><code>render_assoc_items</code></a>. The things there that take the most time is <a href="https://github.com/rust-lang/rust/blob/8a9f7862bcfa5870a34bb54f77a03c73d1db5c37/src/librustdoc/html/render/mod.rs#L3741">rendering impls</a>. In my test, rendering method's is fairly slow. Still trying to track down what is slow about other then we're just allocating a ton.</p>



<a name="227272505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227272505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227272505">(Feb 22 2021 at 14:19)</a>:</h4>
<p>is it being called a lot? or is it slow in absolute terms?</p>



<a name="227272540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227272540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227272540">(Feb 22 2021 at 14:19)</a>:</h4>
<p>Which "it" do you mean?</p>



<a name="227272560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227272560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227272560">(Feb 22 2021 at 14:19)</a>:</h4>
<p><code>render_impl</code></p>



<a name="227273002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273002">(Feb 22 2021 at 14:22)</a>:</h4>
<p>It'd being called quite a bit (~60K times) but seems slower than it should be about 0.2 millseconds per call</p>



<a name="227273047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273047">(Feb 22 2021 at 14:22)</a>:</h4>
<p>I can get exactl numbers in a second</p>



<a name="227273070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273070">(Feb 22 2021 at 14:22)</a>:</h4>
<p>I guess I have no intuition for performance then <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> that seems reasonable to me</p>



<a name="227273081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273081">(Feb 22 2021 at 14:22)</a>:</h4>
<p>sure, thanks :)</p>



<a name="227273159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273159">(Feb 22 2021 at 14:23)</a>:</h4>
<p>I would be interested to see how much of that is from <code>Markdown::into_string</code></p>



<a name="227273211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273211">(Feb 22 2021 at 14:23)</a>:</h4>
<p>everything else looks like "just" lots of allocations</p>



<a name="227273214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273214">(Feb 22 2021 at 14:23)</a>:</h4>
<p>0.2ms per call to make a string of html does feel quite slow.</p>



<a name="227273318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273318">(Feb 22 2021 at 14:24)</a>:</h4>
<p>I wonder if its gonna have inside of it an invocation of something quadratic over number of items in the crate or something.</p>



<a name="227273423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273423">(Feb 22 2021 at 14:25)</a>:</h4>
<p>So it doesn't seem so far like there's going to be one thing that will make things better.</p>



<a name="227273537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273537">(Feb 22 2021 at 14:25)</a>:</h4>
<p>(is <code>render_impl</code> as slow per iteration if you only document a portion of windows-rs?)</p>



<a name="227273897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273897">(Feb 22 2021 at 14:27)</a>:</h4>
<p>In my test <code>render_impl</code> gets called 63231 times and takes 2.45 seconds total. That's pretty slow</p>



<a name="227273940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227273940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227273940">(Feb 22 2021 at 14:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/227273537">said</a>:</p>
<blockquote>
<p>(is <code>render_impl</code> as slow per iteration if you only document a portion of windows-rs?)</p>
</blockquote>
<p>I can check if it scales linearly</p>



<a name="227274519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227274519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227274519">(Feb 22 2021 at 14:31)</a>:</h4>
<p>Yes it looks like it scales roughly linerarly (each iteration takes just as long regardless of the number of items)</p>



<a name="227307879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227307879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227307879">(Feb 22 2021 at 17:47)</a>:</h4>
<p>I believe in order to have an impact on rustdoc html rendering performance, we'll need to audit the entire subgraph or calls to allocating functions. It looks like most of the time is taken in allocation (though I've not been able to directly verify this yet). I've made a branch that has a lot of profile calls in it which can help show where time is being taken: <a href="https://github.com/rylev/rust/compare/master...rylev:rustdoc-investigation?expand=1">https://github.com/rylev/rust/compare/master...rylev:rustdoc-investigation?expand=1</a></p>



<a name="227309460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227309460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227309460">(Feb 22 2021 at 17:56)</a>:</h4>
<p>(deleted)</p>



<a name="227309542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227309542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227309542">(Feb 22 2021 at 17:57)</a>:</h4>
<p>That sounds like about what I'd expect, yeah.</p>



<a name="227309543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227309543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227309543">(Feb 22 2021 at 17:57)</a>:</h4>
<p>If you want to make a PR with the timing changes that sounds useful :) I see it depends on the changes to write! but it can get merged after that</p>



<a name="227309838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227309838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227309838">(Feb 22 2021 at 17:58)</a>:</h4>
<p>I'm not sure how useful some of these will be in the general case, but I can clean it up and we can merge a subset at least.</p>



<a name="227312944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227312944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Vandel Sillesen <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227312944">(Feb 22 2021 at 18:19)</a>:</h4>
<p>Would it be worthwhile to let <code>render_impl</code> and friends write into a <code>Write</code> where the <code>Write</code> is a BufWriter of the File we want rustdoc to generate? I think that would <br>
a) reduce peak memory usage since we can flush to the file in chunks<br>
b) reduce reallocations that (I think) are occuring a lot especially with huge crates like windows-rs</p>
<p>From a quick glance at the code, the <code>Buffer</code>abstraction could probably be modified to write into the <code>Write</code>mentioned above, instead of into its own String.</p>
<p>(I haven't profiled the code, just lurking here)</p>



<a name="227453016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227453016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227453016">(Feb 23 2021 at 15:57)</a>:</h4>
<p>I think this would be interesting to try. I think it'd be especially compelling if we could try to get memory usage down, but I'm not sure anymore that our memory problems are from allocations from the html rendering since these files get handled one at a time.</p>



<a name="227455414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227455414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227455414">(Feb 23 2021 at 16:06)</a>:</h4>
<p>you can see the memory usage with -Z time-passes</p>



<a name="227455512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227455512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227455512">(Feb 23 2021 at 16:06)</a>:</h4>
<p>IIRC something like 17 GB comes from either rustc or <code>core</code>, and render only uses about 3 GB</p>



<a name="227456175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227456175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227456175">(Feb 23 2021 at 16:09)</a>:</h4>
<p>Yea, it's clear that rendering is not the main culprit, but we shouldn't refrain from looking into an issue just because it's not the worse offender. Render uses more memory than it absolutely needs to and therefore we should probably bring that number down, even if it won't fix the largest case of over use of memory in rustdoc.</p>



<a name="227467989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227467989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227467989">(Feb 23 2021 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> what do you want to do about <a href="https://github.com/rust-lang/rust/pull/82397#issuecomment-784325830">https://github.com/rust-lang/rust/pull/82397#issuecomment-784325830</a> ?</p>



<a name="227468028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227468028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227468028">(Feb 23 2021 at 17:18)</a>:</h4>
<p>I'll be honest, I'm not super experienced with performance work so I'm probably not the best reviewer</p>



<a name="227468297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227468297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227468297">(Feb 23 2021 at 17:20)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I think the right move is to close for now. We've learned quite a bit, but those changes don't seem to have a material positive impact of the performance.</p>



<a name="227468353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227468353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227468353">(Feb 23 2021 at 17:20)</a>:</h4>
<p>Ok, sounds good. Thank you for working on it :)</p>



<a name="227474252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227474252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227474252">(Feb 23 2021 at 17:56)</a>:</h4>
<p>Yeah rylev this is all very good stuff and I'm super happy someone has had the time to do these things.</p>



<a name="227889561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227889561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227889561">(Feb 26 2021 at 06:56)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> Another thing that might be worth trying: can you benchmark a few allocators on Windows, and see if switching to mimalloc (for instance) is substantially faster?</p>



<a name="227901197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/227901197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#227901197">(Feb 26 2021 at 09:15)</a>:</h4>
<p>Yes , that's on my list of things to try.</p>



<a name="229153296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/229153296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#229153296">(Mar 07 2021 at 03:52)</a>:</h4>
<p><span class="user-mention" data-user-id="224872">@rylev</span> fyi <span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> suggested using <a href="https://github.com/japaric/ufmt">https://github.com/japaric/ufmt</a> instead of <code>write!</code> directly as a way to speed up <a href="https://github.com/rust-lang/rust/pull/82397">https://github.com/rust-lang/rust/pull/82397</a>. It avoids panics/result and also optimizes for code size over speed.</p>



<a name="229153389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/229153389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#229153389">(Mar 07 2021 at 03:54)</a>:</h4>
<p>sorry, it optimizes for speed over compile time and code size. i also mainly mention it because it was mentioned that the reason it was too slow was the <code>write!</code> formatter invocations — which sounds like the exact problem.</p>
<p>that said, it was a drive by comment, i suspect it's worth looking into if it's as easy of a replacement as it seems like it might be, but it's hare to actually endorse given that i have very little context here at best <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="236085535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236085535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236085535">(Apr 25 2021 at 18:53)</a>:</h4>
<p>I should note that <code>write!</code> itself, if it can be avoided via simply using <code>.write()</code>, can have a profound impact: <a href="https://github.com/rust-lang/rust/issues/10761">https://github.com/rust-lang/rust/issues/10761</a></p>



<a name="236119234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236119234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236119234">(Apr 26 2021 at 04:36)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> Wow.</p>



<a name="236119249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236119249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236119249">(Apr 26 2021 at 04:36)</a>:</h4>
<p>I have some code that makes fairly extensive use of <code>write!</code>. It'd definitely be nice to have that special-case the "no formatting to do" case and skip the formatting machinery.</p>



<a name="236119277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236119277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236119277">(Apr 26 2021 at 04:37)</a>:</h4>
<p>yeah I tried to PR a start to something like that but I got overwhelmed by "it's actually harder than it looks".</p>



<a name="236119339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236119339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236119339">(Apr 26 2021 at 04:38)</a>:</h4>
<p>Wasn't there a similar change to the format machinery to do the same thing?</p>



<a name="236119388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/windows-rs%20perf/near/236119388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/windows-rs.20perf.html#236119388">(Apr 26 2021 at 04:38)</a>:</h4>
<p>Something about making <code>fmt::Arguments</code> special-case the non-formatting case?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>